summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files/ajax/upload.php14
-rw-r--r--apps/files/appinfo/remote.php2
-rw-r--r--apps/files/l10n/af_ZA.js1
-rw-r--r--apps/files/l10n/af_ZA.json1
-rw-r--r--apps/files_encryption/lib/proxy.php1
-rw-r--r--apps/files_encryption/lib/session.php31
-rw-r--r--apps/files_encryption/tests/hooks.php2
-rwxr-xr-xapps/files_encryption/tests/share.php22
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/NOTICE4
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/README40
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/README.md77
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/Abstract.php (renamed from apps/files_external/3rdparty/google-api-php-client/src/auth/Google_Auth.php)25
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/AssertionCredentials.php (renamed from apps/files_external/3rdparty/google-api-php-client/src/auth/Google_AssertionCredentials.php)52
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/Exception.php22
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/LoginTicket.php (renamed from apps/files_external/3rdparty/google-api-php-client/src/auth/Google_LoginTicket.php)20
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/OAuth2.php620
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/Simple.php62
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Cache/Abstract.php (renamed from apps/files_external/3rdparty/google-api-php-client/src/cache/Google_Cache.php)16
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Cache/Apc.php73
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Cache/Exception.php21
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Cache/File.php145
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Cache/Memcache.php137
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Client.php665
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Collection.php96
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Config.php371
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Exception.php (renamed from apps/files_external/3rdparty/google-api-php-client/src/service/Google_Service.php)8
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Http/Batch.php (renamed from apps/files_external/3rdparty/google-api-php-client/src/service/Google_BatchRequest.php)79
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Http/CacheParser.php (renamed from apps/files_external/3rdparty/google-api-php-client/src/io/Google_CacheParser.php)37
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Http/MediaFileUpload.php301
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Http/REST.php (renamed from apps/files_external/3rdparty/google-api-php-client/src/io/Google_REST.php)75
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Http/Request.php476
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/IO/Abstract.php332
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/IO/Curl.php137
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/IO/Exception.php22
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/IO/Stream.php211
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/IO/cacerts.pem (renamed from apps/files_external/3rdparty/google-api-php-client/src/io/cacerts.pem)24
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Model.php265
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Service.php39
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Service/Drive.php6136
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Service/Exception.php53
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Service/Resource.php210
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Signer/Abstract.php (renamed from apps/files_external/3rdparty/google-api-php-client/src/auth/Google_Signer.php)5
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Signer/P12.php91
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Utils.php (renamed from apps/files_external/3rdparty/google-api-php-client/src/service/Google_Utils.php)56
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Utils/URITemplate.php333
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Verifier/Abstract.php (renamed from apps/files_external/3rdparty/google-api-php-client/src/auth/Google_Verifier.php)5
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google/Verifier/Pem.php (renamed from apps/files_external/3rdparty/google-api-php-client/src/auth/Google_PemVerifier.php)26
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/Google_Client.php462
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/auth/Google_AuthNone.php48
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/auth/Google_OAuth2.php445
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/auth/Google_P12Signer.php70
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/cache/Google_ApcCache.php98
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/cache/Google_FileCache.php137
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/cache/Google_MemcacheCache.php130
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/config.php81
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/contrib/Google_DriveService.php3143
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/external/URITemplateParser.php209
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/io/Google_CurlIO.php278
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/io/Google_HttpRequest.php304
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/io/Google_IO.php49
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/service/Google_MediaFileUpload.php262
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/service/Google_Model.php115
-rw-r--r--apps/files_external/3rdparty/google-api-php-client/src/service/Google_ServiceResource.php205
-rw-r--r--apps/files_external/ajax/google.php3
-rw-r--r--apps/files_external/lib/api.php4
-rw-r--r--apps/files_external/lib/google.php56
-rw-r--r--apps/files_external/lib/smb.php9
-rw-r--r--apps/files_sharing/ajax/list.php4
-rw-r--r--apps/files_sharing/ajax/shareinfo.php2
-rw-r--r--apps/files_sharing/l10n/ca.js6
-rw-r--r--apps/files_sharing/l10n/ca.json6
-rw-r--r--apps/files_sharing/lib/controllers/sharecontroller.php11
-rw-r--r--apps/files_sharing/lib/readonlycache.php4
-rw-r--r--apps/files_sharing/lib/readonlywrapper.php2
-rw-r--r--apps/files_sharing/lib/sharedstorage.php14
-rw-r--r--apps/files_sharing/public.php2
-rw-r--r--apps/files_sharing/publicwebdav.php2
-rw-r--r--apps/files_sharing/tests/api.php6
-rw-r--r--apps/files_sharing/tests/cache.php4
-rw-r--r--apps/files_sharing/tests/controller/sharecontroller.php2
-rw-r--r--apps/files_sharing/tests/share.php28
-rw-r--r--apps/files_trashbin/l10n/af_ZA.js6
-rw-r--r--apps/files_trashbin/l10n/af_ZA.json4
-rw-r--r--apps/files_trashbin/lib/helper.php2
-rw-r--r--apps/files_versions/tests/versions.php4
-rw-r--r--apps/user_ldap/ajax/wizard.php2
-rw-r--r--apps/user_ldap/js/ldapFilter.js63
-rw-r--r--apps/user_ldap/js/settings.js117
-rw-r--r--apps/user_ldap/l10n/af_ZA.js1
-rw-r--r--apps/user_ldap/l10n/af_ZA.json1
-rw-r--r--apps/user_ldap/l10n/cs_CZ.js1
-rw-r--r--apps/user_ldap/l10n/cs_CZ.json1
-rw-r--r--apps/user_ldap/l10n/da.js1
-rw-r--r--apps/user_ldap/l10n/da.json1
-rw-r--r--apps/user_ldap/l10n/de.js1
-rw-r--r--apps/user_ldap/l10n/de.json1
-rw-r--r--apps/user_ldap/l10n/de_DE.js1
-rw-r--r--apps/user_ldap/l10n/de_DE.json1
-rw-r--r--apps/user_ldap/l10n/en_GB.js1
-rw-r--r--apps/user_ldap/l10n/en_GB.json1
-rw-r--r--apps/user_ldap/l10n/fr.js7
-rw-r--r--apps/user_ldap/l10n/fr.json7
-rw-r--r--apps/user_ldap/l10n/it.js1
-rw-r--r--apps/user_ldap/l10n/it.json1
-rw-r--r--apps/user_ldap/l10n/nl.js1
-rw-r--r--apps/user_ldap/l10n/nl.json1
-rw-r--r--apps/user_ldap/l10n/pt_BR.js1
-rw-r--r--apps/user_ldap/l10n/pt_BR.json1
-rw-r--r--apps/user_ldap/l10n/tr.js1
-rw-r--r--apps/user_ldap/l10n/tr.json1
-rw-r--r--apps/user_ldap/lib/access.php32
-rw-r--r--apps/user_ldap/lib/wizard.php57
-rw-r--r--apps/user_ldap/tests/user_ldap.php32
-rw-r--r--apps/user_ldap/user_ldap.php3
-rw-r--r--config/config.sample.php15
-rw-r--r--core/l10n/ca.js2
-rw-r--r--core/l10n/ca.json2
-rw-r--r--core/l10n/da.js14
-rw-r--r--core/l10n/da.json14
-rw-r--r--core/l10n/fr.js2
-rw-r--r--core/l10n/fr.json2
-rw-r--r--core/setup/controller.php21
-rw-r--r--lib/base.php14
-rw-r--r--lib/l10n/ca.js1
-rw-r--r--lib/l10n/ca.json1
-rw-r--r--lib/l10n/da.js2
-rw-r--r--lib/l10n/da.json2
-rw-r--r--lib/l10n/uk.js3
-rw-r--r--lib/l10n/uk.json3
-rw-r--r--lib/private/activitymanager.php16
-rw-r--r--lib/private/api.php38
-rw-r--r--lib/private/app.php59
-rw-r--r--lib/private/app/infoparser.php84
-rw-r--r--lib/private/appframework/app.php10
-rw-r--r--lib/private/appframework/http/dispatcher.php8
-rw-r--r--lib/private/arrayparser.php5
-rw-r--r--lib/private/contacts/localaddressbook.php2
-rw-r--r--lib/private/contactsmanager.php4
-rw-r--r--lib/private/databaseexception.php23
-rw-r--r--lib/private/databasesetupexception.php12
-rw-r--r--lib/private/db.php36
-rw-r--r--lib/private/db/connectionfactory.php4
-rw-r--r--lib/private/db/sqlitesessioninit.php10
-rw-r--r--lib/private/files.php21
-rw-r--r--lib/private/files/cache/cache.php2
-rw-r--r--lib/private/files/cache/wrapper/cachejail.php255
-rw-r--r--lib/private/files/cache/wrapper/cachepermissionsmask.php32
-rw-r--r--lib/private/files/cache/wrapper/cachewrapper.php247
-rw-r--r--lib/private/files/fileinfo.php10
-rw-r--r--lib/private/files/node/file.php10
-rw-r--r--lib/private/files/node/folder.php8
-rw-r--r--lib/private/files/node/node.php10
-rw-r--r--lib/private/files/node/root.php2
-rw-r--r--lib/private/files/objectstore/objectstorestorage.php6
-rw-r--r--lib/private/files/storage/common.php10
-rw-r--r--lib/private/files/storage/dav.php24
-rw-r--r--lib/private/files/storage/local.php77
-rw-r--r--lib/private/files/storage/mappedlocal.php65
-rw-r--r--lib/private/files/storage/wrapper/jail.php413
-rw-r--r--lib/private/files/storage/wrapper/permissionsmask.php111
-rw-r--r--lib/private/files/view.php10
-rw-r--r--lib/private/group/backend.php32
-rw-r--r--lib/private/group/database.php2
-rw-r--r--lib/private/group/group.php8
-rw-r--r--lib/private/group/interface.php2
-rw-r--r--lib/private/group/manager.php2
-rw-r--r--lib/private/helper.php5
-rw-r--r--lib/private/installer.php6
-rw-r--r--lib/private/l10n.php48
-rw-r--r--lib/private/migrate.php626
-rw-r--r--lib/private/migration/content.php246
-rw-r--r--lib/private/migration/provider.php52
-rw-r--r--lib/private/naturalsort.php11
-rw-r--r--lib/private/naturalsort_defaultcollator.php19
-rw-r--r--lib/private/preview.php80
-rw-r--r--lib/private/preview/bitmap.php126
-rw-r--r--lib/private/preview/illustrator.php19
-rw-r--r--lib/private/preview/image.php9
-rw-r--r--lib/private/preview/markdown.php18
-rw-r--r--lib/private/preview/movie.php94
-rw-r--r--lib/private/preview/movies.php106
-rw-r--r--lib/private/preview/mp3.php15
-rw-r--r--lib/private/preview/msoffice2003.php18
-rw-r--r--lib/private/preview/msoffice2007.php18
-rw-r--r--lib/private/preview/msofficedoc.php18
-rw-r--r--lib/private/preview/office-cl.php138
-rw-r--r--lib/private/preview/office.php84
-rw-r--r--lib/private/preview/opendocument.php18
-rw-r--r--lib/private/preview/pdf.php19
-rw-r--r--lib/private/preview/photoshop.php19
-rw-r--r--lib/private/preview/postscript.php19
-rw-r--r--lib/private/preview/provider.php12
-rw-r--r--lib/private/preview/staroffice.php18
-rw-r--r--lib/private/preview/svg.php71
-rw-r--r--lib/private/preview/tiff.php19
-rw-r--r--lib/private/preview/txt.php29
-rw-r--r--lib/private/repair.php2
-rw-r--r--lib/private/server.php30
-rw-r--r--lib/private/setup.php7
-rw-r--r--lib/private/setup/mssql.php2
-rw-r--r--lib/private/setup/mysql.php6
-rw-r--r--lib/private/setup/oci.php6
-rw-r--r--lib/private/setup/postgresql.php4
-rw-r--r--lib/private/share/helper.php9
-rw-r--r--lib/private/share/share.php12
-rw-r--r--lib/private/urlgenerator.php12
-rw-r--r--lib/private/user/backend.php45
-rw-r--r--lib/private/user/interface.php4
-rw-r--r--lib/private/user/manager.php6
-rw-r--r--lib/private/user/session.php17
-rw-r--r--lib/private/user/user.php14
-rw-r--r--lib/private/util.php2
-rw-r--r--lib/public/activity/iextension.php7
-rw-r--r--lib/public/appframework/http/response.php73
-rw-r--r--lib/public/constants.php28
-rw-r--r--lib/public/files/fileinfo.php12
-rw-r--r--lib/public/files/ihomestorage.php24
-rw-r--r--lib/public/files/node.php10
-rw-r--r--lib/public/files/storage.php4
-rw-r--r--lib/public/iavatar.php6
-rw-r--r--lib/public/iservercontainer.php7
-rw-r--r--lib/public/iurlgenerator.php8
-rw-r--r--lib/public/share.php83
-rw-r--r--lib/public/share_backend.php68
-rw-r--r--lib/public/share_backend_collection.php29
-rw-r--r--lib/public/share_backend_file_dependent.php31
-rw-r--r--lib/public/template.php2
-rw-r--r--lib/public/util.php4
-rwxr-xr-xocc2
-rw-r--r--settings/l10n/ca.js32
-rw-r--r--settings/l10n/ca.json32
-rw-r--r--settings/l10n/sk_SK.js1
-rw-r--r--settings/l10n/sk_SK.json1
-rw-r--r--settings/l10n/tr.js2
-rw-r--r--settings/l10n/tr.json2
-rw-r--r--settings/l10n/uk.js4
-rw-r--r--settings/l10n/uk.json4
-rw-r--r--tests/core/lostpassword/controller/lostcontrollertest.php5
-rw-r--r--tests/data/app/expected-info.json19
-rw-r--r--tests/data/app/invalid-info.xml22
-rw-r--r--tests/data/app/valid-info.xml22
-rw-r--r--tests/lib/activitymanager.php7
-rw-r--r--tests/lib/app/infoparser.php53
-rw-r--r--tests/lib/appframework/AppTest.php2
-rw-r--r--tests/lib/appframework/http/DispatcherTest.php16
-rw-r--r--tests/lib/appframework/http/ResponseTest.php86
-rw-r--r--tests/lib/connector/sabre/file.php14
-rw-r--r--tests/lib/connector/sabre/node.php18
-rw-r--r--tests/lib/files/cache/cache.php8
-rw-r--r--tests/lib/files/cache/wrapper/cachejail.php67
-rw-r--r--tests/lib/files/cache/wrapper/cachepermissionsmask.php94
-rw-r--r--tests/lib/files/node/file.php28
-rw-r--r--tests/lib/files/node/folder.php14
-rw-r--r--tests/lib/files/node/node.php6
-rw-r--r--tests/lib/files/storage/wrapper/jail.php55
-rw-r--r--tests/lib/files/storage/wrapper/permissionsmask.php105
-rw-r--r--tests/lib/migrate.php98
-rw-r--r--tests/lib/share/backend.php2
-rw-r--r--tests/lib/share/helper.php6
-rw-r--r--tests/lib/share/share.php140
-rw-r--r--tests/lib/tags.php2
-rw-r--r--tests/lib/tempmanager.php4
-rw-r--r--tests/lib/testcase.php4
-rw-r--r--tests/preseed-config.php33
264 files changed, 14740 insertions, 8590 deletions
diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php
index b960e02ced7..eb99d0644f7 100644
--- a/apps/files/ajax/upload.php
+++ b/apps/files/ajax/upload.php
@@ -1,5 +1,7 @@
<?php
+\OC::$server->getSession()->close();
+
// Firefox and Konqueror tries to download application/json for me. --Arthur
OCP\JSON::setContentTypeHeader('text/plain');
@@ -7,7 +9,7 @@ OCP\JSON::setContentTypeHeader('text/plain');
// If not, check the login.
// If no token is sent along, rely on login only
-$allowedPermissions = OCP\PERMISSION_ALL;
+$allowedPermissions = \OCP\Constants::PERMISSION_ALL;
$errorCode = null;
$l = \OC::$server->getL10N('files');
@@ -27,7 +29,7 @@ if (empty($_POST['dirToken'])) {
\OC_User::setIncognitoMode(true);
// return only read permissions for public upload
- $allowedPermissions = OCP\PERMISSION_READ;
+ $allowedPermissions = \OCP\Constants::PERMISSION_READ;
$publicDirectory = !empty($_POST['subdir']) ? $_POST['subdir'] : '/';
$linkItem = OCP\Share::getShareByToken($_POST['dirToken']);
@@ -36,7 +38,7 @@ if (empty($_POST['dirToken'])) {
die();
}
- if (!($linkItem['permissions'] & OCP\PERMISSION_CREATE)) {
+ if (!($linkItem['permissions'] & \OCP\Constants::PERMISSION_CREATE)) {
OCP\JSON::checkLoggedIn();
} else {
// resolve reshares
@@ -64,13 +66,7 @@ if (empty($_POST['dirToken'])) {
}
}
-
OCP\JSON::callCheck();
-if (!\OCP\App::isEnabled('files_encryption')) {
- // encryption app need to create keys later, so can't close too early
- \OC::$server->getSession()->close();
-}
-
// get array with current storage stats (e.g. max file size)
$storageStats = \OCA\Files\Helper::buildFileStorageStatistics($dir);
diff --git a/apps/files/appinfo/remote.php b/apps/files/appinfo/remote.php
index 3ba25085bad..26bef966f79 100644
--- a/apps/files/appinfo/remote.php
+++ b/apps/files/appinfo/remote.php
@@ -38,7 +38,7 @@ $server->setBaseUri($baseuri);
$defaults = new OC_Defaults();
$server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend, $defaults->getName()));
$server->addPlugin(new \Sabre\DAV\Locks\Plugin($lockBackend));
-$server->addPlugin(new \Sabre\DAV\Browser\Plugin(false)); // Show something in the Browser, but no upload
+$server->addPlugin(new \Sabre\DAV\Browser\Plugin(false, false)); // Show something in the Browser, but no upload
$server->addPlugin(new OC_Connector_Sabre_FilesPlugin());
$server->addPlugin(new OC_Connector_Sabre_MaintenancePlugin());
$server->addPlugin(new OC_Connector_Sabre_ExceptionLoggerPlugin('webdav'));
diff --git a/apps/files/l10n/af_ZA.js b/apps/files/l10n/af_ZA.js
index 1a4639183ed..8671027db6e 100644
--- a/apps/files/l10n/af_ZA.js
+++ b/apps/files/l10n/af_ZA.js
@@ -3,6 +3,7 @@ OC.L10N.register(
{
"Share" : "Deel",
"Unshare" : "Deel terug neem",
+ "Error" : "Fout",
"_%n folder_::_%n folders_" : ["",""],
"_%n file_::_%n files_" : ["",""],
"_Uploading %n file_::_Uploading %n files_" : ["",""],
diff --git a/apps/files/l10n/af_ZA.json b/apps/files/l10n/af_ZA.json
index 0e7116887f0..cd3182e3f69 100644
--- a/apps/files/l10n/af_ZA.json
+++ b/apps/files/l10n/af_ZA.json
@@ -1,6 +1,7 @@
{ "translations": {
"Share" : "Deel",
"Unshare" : "Deel terug neem",
+ "Error" : "Fout",
"_%n folder_::_%n folders_" : ["",""],
"_%n file_::_%n files_" : ["",""],
"_Uploading %n file_::_Uploading %n files_" : ["",""],
diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php
index 55f2df783c4..a358a46a6e7 100644
--- a/apps/files_encryption/lib/proxy.php
+++ b/apps/files_encryption/lib/proxy.php
@@ -91,7 +91,6 @@ class Proxy extends \OC_FileProxy {
private function shouldEncrypt($path, $mode = 'w') {
$userId = Helper::getUser($path);
- $session = new Session(new \OC\Files\View());
// don't call the crypt stream wrapper, if...
if (
diff --git a/apps/files_encryption/lib/session.php b/apps/files_encryption/lib/session.php
index 7bd4fd02421..132748b6ea5 100644
--- a/apps/files_encryption/lib/session.php
+++ b/apps/files_encryption/lib/session.php
@@ -29,6 +29,7 @@ namespace OCA\Encryption;
class Session {
private $view;
+ private static $publicShareKey = false;
const NOT_INITIALIZED = '0';
const INIT_EXECUTED = '1';
@@ -92,7 +93,7 @@ class Session {
}
- if (\OCA\Encryption\Helper::isPublicAccess()) {
+ if (\OCA\Encryption\Helper::isPublicAccess() && !self::getPublicSharePrivateKey()) {
// Disable encryption proxy to prevent recursive calls
$proxyStatus = \OC_FileProxy::$enabled;
\OC_FileProxy::$enabled = false;
@@ -100,9 +101,7 @@ class Session {
$encryptedKey = $this->view->file_get_contents(
'/owncloud_private_key/' . $publicShareKeyId . '.private.key');
$privateKey = Crypt::decryptPrivateKey($encryptedKey, '');
- $this->setPublicSharePrivateKey($privateKey);
-
- $this->setInitialized(\OCA\Encryption\Session::INIT_SUCCESSFUL);
+ self::setPublicSharePrivateKey($privateKey);
\OC_FileProxy::$enabled = $proxyStatus;
}
@@ -127,8 +126,8 @@ class Session {
* remove keys from session
*/
public function removeKeys() {
- \OC::$session->remove('publicSharePrivateKey');
- \OC::$session->remove('privateKey');
+ \OC::$server->getSession()->remove('publicSharePrivateKey');
+ \OC::$server->getSession()->remove('privateKey');
}
/**
@@ -164,6 +163,8 @@ class Session {
public function getInitialized() {
if (!is_null(\OC::$server->getSession()->get('encryptionInitialized'))) {
return \OC::$server->getSession()->get('encryptionInitialized');
+ } else if (\OCA\Encryption\Helper::isPublicAccess() && self::getPublicSharePrivateKey()) {
+ return self::INIT_SUCCESSFUL;
} else {
return self::NOT_INITIALIZED;
}
@@ -177,7 +178,7 @@ class Session {
public function getPrivateKey() {
// return the public share private key if this is a public access
if (\OCA\Encryption\Helper::isPublicAccess()) {
- return $this->getPublicSharePrivateKey();
+ return self::getPublicSharePrivateKey();
} else {
if (!is_null(\OC::$server->getSession()->get('privateKey'))) {
return \OC::$server->getSession()->get('privateKey');
@@ -192,12 +193,9 @@ class Session {
* @param string $privateKey
* @return bool
*/
- public function setPublicSharePrivateKey($privateKey) {
-
- \OC::$server->getSession()->set('publicSharePrivateKey', $privateKey);
-
+ private static function setPublicSharePrivateKey($privateKey) {
+ self::$publicShareKey = $privateKey;
return true;
-
}
/**
@@ -205,13 +203,8 @@ class Session {
* @return string $privateKey
*
*/
- public function getPublicSharePrivateKey() {
-
- if (!is_null(\OC::$server->getSession()->get('publicSharePrivateKey'))) {
- return \OC::$server->getSession()->get('publicSharePrivateKey');
- } else {
- return false;
- }
+ private static function getPublicSharePrivateKey() {
+ return self::$publicShareKey;
}
}
diff --git a/apps/files_encryption/tests/hooks.php b/apps/files_encryption/tests/hooks.php
index 9ea84cc94c2..4b8be0c7c1c 100644
--- a/apps/files_encryption/tests/hooks.php
+++ b/apps/files_encryption/tests/hooks.php
@@ -256,7 +256,7 @@ class Test_Encryption_Hooks extends \OCA\Files_Encryption\Tests\TestCase {
$this->assertTrue($fileInfo instanceof \OC\Files\FileInfo);
// share the file with user2
- \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_ENCRYPTION_HOOKS_USER2, OCP\PERMISSION_ALL);
+ \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_ENCRYPTION_HOOKS_USER2, \OCP\Constants::PERMISSION_ALL);
// check if new share key exists
$this->assertTrue($this->rootView->file_exists(
diff --git a/apps/files_encryption/tests/share.php b/apps/files_encryption/tests/share.php
index 20ee2cc7064..24b828433d0 100755
--- a/apps/files_encryption/tests/share.php
+++ b/apps/files_encryption/tests/share.php
@@ -171,7 +171,7 @@ class Test_Encryption_Share extends \OCA\Files_Encryption\Tests\TestCase {
\OC_FileProxy::$enabled = $proxyStatus;
// share the file
- \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2, OCP\PERMISSION_ALL);
+ \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2, \OCP\Constants::PERMISSION_ALL);
// login as admin
self::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1);
@@ -232,7 +232,7 @@ class Test_Encryption_Share extends \OCA\Files_Encryption\Tests\TestCase {
'/' . \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2 . '/files/' . $this->filename);
// share the file with user3
- \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER3, OCP\PERMISSION_ALL);
+ \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER3, \OCP\Constants::PERMISSION_ALL);
// login as admin
self::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1);
@@ -328,7 +328,7 @@ class Test_Encryption_Share extends \OCA\Files_Encryption\Tests\TestCase {
\OC_FileProxy::$enabled = $proxyStatus;
// share the folder with user1
- \OCP\Share::shareItem('folder', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2, OCP\PERMISSION_ALL);
+ \OCP\Share::shareItem('folder', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2, \OCP\Constants::PERMISSION_ALL);
// login as admin
self::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1);
@@ -406,7 +406,7 @@ class Test_Encryption_Share extends \OCA\Files_Encryption\Tests\TestCase {
\OC_FileProxy::$enabled = $proxyStatus;
// share the file with user3
- \OCP\Share::shareItem('folder', $fileInfoSubFolder['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER3, OCP\PERMISSION_ALL);
+ \OCP\Share::shareItem('folder', $fileInfoSubFolder['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER3, \OCP\Constants::PERMISSION_ALL);
// login as admin
self::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1);
@@ -437,7 +437,7 @@ class Test_Encryption_Share extends \OCA\Files_Encryption\Tests\TestCase {
$this->assertTrue($fileInfo instanceof \OC\Files\FileInfo);
// share the file with user3
- \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER4, OCP\PERMISSION_ALL);
+ \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER4, \OCP\Constants::PERMISSION_ALL);
// login as admin
self::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1);
@@ -539,7 +539,7 @@ class Test_Encryption_Share extends \OCA\Files_Encryption\Tests\TestCase {
\OC_FileProxy::$enabled = $proxyStatus;
// share the file
- \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_LINK, false, OCP\PERMISSION_ALL);
+ \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_LINK, false, \OCP\Constants::PERMISSION_ALL);
// login as admin
self::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1);
@@ -617,7 +617,7 @@ class Test_Encryption_Share extends \OCA\Files_Encryption\Tests\TestCase {
\OC_FileProxy::$enabled = $proxyStatus;
// share the file
- \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_GROUP, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_GROUP1, OCP\PERMISSION_ALL);
+ \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_GROUP, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_GROUP1, \OCP\Constants::PERMISSION_ALL);
// login as admin
self::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1);
@@ -923,7 +923,7 @@ class Test_Encryption_Share extends \OCA\Files_Encryption\Tests\TestCase {
// share the file
try {
- \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_GROUP, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_GROUP1, OCP\PERMISSION_ALL);
+ \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_GROUP, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_GROUP1, \OCP\Constants::PERMISSION_ALL);
} catch (Exception $e) {
$this->assertEquals(0, strpos($e->getMessage(), "Following users are not set up for encryption"));
}
@@ -991,7 +991,7 @@ class Test_Encryption_Share extends \OCA\Files_Encryption\Tests\TestCase {
$this->assertTrue($fileInfo instanceof \OC\Files\FileInfo);
// share the file
- \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2, OCP\PERMISSION_ALL);
+ \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2, \OCP\Constants::PERMISSION_ALL);
// check if share key for user2 exists
$this->assertTrue($this->view->file_exists(
@@ -1059,7 +1059,7 @@ class Test_Encryption_Share extends \OCA\Files_Encryption\Tests\TestCase {
$this->assertTrue($fileInfo instanceof \OC\Files\FileInfo);
// share the folder
- \OCP\Share::shareItem('folder', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2, OCP\PERMISSION_ALL);
+ \OCP\Share::shareItem('folder', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2, \OCP\Constants::PERMISSION_ALL);
\OC\Files\Filesystem::rename($folder, $newFolder);
@@ -1117,7 +1117,7 @@ class Test_Encryption_Share extends \OCA\Files_Encryption\Tests\TestCase {
$this->assertTrue($fileInfo instanceof \OC\Files\FileInfo);
// share the folder
- \OCP\Share::shareItem('folder', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2, OCP\PERMISSION_ALL);
+ \OCP\Share::shareItem('folder', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2, \OCP\Constants::PERMISSION_ALL);
// check that the share keys exist
$this->assertTrue($view->file_exists('files_encryption/share-keys' . $folder . '/' . $filename . '.' . \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1 . '.shareKey'));
diff --git a/apps/files_external/3rdparty/google-api-php-client/NOTICE b/apps/files_external/3rdparty/google-api-php-client/NOTICE
deleted file mode 100644
index 22d7cb59867..00000000000
--- a/apps/files_external/3rdparty/google-api-php-client/NOTICE
+++ /dev/null
@@ -1,4 +0,0 @@
-This product contains the following libraries:
-
-XRDS-Simple library from http://code.google.com/p/diso/
-Apache License 2.0
diff --git a/apps/files_external/3rdparty/google-api-php-client/README b/apps/files_external/3rdparty/google-api-php-client/README
deleted file mode 100644
index 42c42c0d5c7..00000000000
--- a/apps/files_external/3rdparty/google-api-php-client/README
+++ /dev/null
@@ -1,40 +0,0 @@
-Google APIs Client Library for PHP
-=====================================
-
-== Description
-The Google API Client Library enables you to work with Google APIs such as Google+, Drive, Tasks, or Latitude on your server.
-
-Requirements:
- PHP 5.2.x or higher [http://www.php.net/]
- PHP Curl extension [http://www.php.net/manual/en/intro.curl.php]
- PHP JSON extension [http://php.net/manual/en/book.json.php]
-
-Project page:
- http://code.google.com/p/google-api-php-client
-
-OAuth 2 instructions:
- http://code.google.com/p/google-api-php-client/wiki/OAuth2
-
-Report a defect or feature request here:
- http://code.google.com/p/google-api-php-client/issues/entry
-
-Subscribe to project updates in your feed reader:
- http://code.google.com/feeds/p/google-api-php-client/updates/basic
-
-Supported sample applications:
- http://code.google.com/p/google-api-php-client/wiki/Samples
-
-== Basic Example
- <?php
- require_once 'path/to/src/Google_Client.php';
- require_once 'path/to/src/contrib/apiBooksService.php';
-
- $client = new Google_Client();
- $service = new Google_BooksService($client);
-
- $optParams = array('filter' => 'free-ebooks');
- $results = $service->volumes->listVolumes('Henry David Thoreau', $optParams);
-
- foreach ($results['items'] as $item) {
- print($item['volumeInfo']['title'] . '<br>');
- }
diff --git a/apps/files_external/3rdparty/google-api-php-client/README.md b/apps/files_external/3rdparty/google-api-php-client/README.md
new file mode 100644
index 00000000000..e799f6725da
--- /dev/null
+++ b/apps/files_external/3rdparty/google-api-php-client/README.md
@@ -0,0 +1,77 @@
+[![Build Status](https://travis-ci.org/google/google-api-php-client.svg)](https://travis-ci.org/google/google-api-php-client)
+
+# Google APIs Client Library for PHP #
+
+## Description ##
+The Google API Client Library enables you to work with Google APIs such as Google+, Drive, or YouTube on your server.
+
+## Beta ##
+This library is in Beta. We're comfortable enough with the stability and features of the library that we want you to build real production applications on it. We will make an effort to support the public and protected surface of the library and maintain backwards compatibility in the future. While we are still in Beta, we reserve the right to make incompatible changes. If we do remove some functionality (typically because better functionality exists or if the feature proved infeasible), our intention is to deprecate and provide ample time for developers to update their code.
+
+## Requirements ##
+* [PHP 5.2.1 or higher](http://www.php.net/)
+* [PHP JSON extension](http://php.net/manual/en/book.json.php)
+
+*Note*: some features (service accounts and id token verification) require PHP 5.3.0 and above due to cryptographic algorithm requirements.
+
+## Developer Documentation ##
+http://developers.google.com/api-client-library/php
+
+## Installation ##
+
+For the latest installation and setup instructions, see [the documentation](https://developers.google.com/api-client-library/php/start/installation).
+
+## Basic Example ##
+See the examples/ directory for examples of the key client features.
+```PHP
+<?php
+ require_once 'google-api-php-client/autoload.php'; // or wherever autoload.php is located
+ $client = new Google_Client();
+ $client->setApplicationName("Client_Library_Examples");
+ $client->setDeveloperKey("YOUR_APP_KEY");
+ $service = new Google_Service_Books($client);
+ $optParams = array('filter' => 'free-ebooks');
+ $results = $service->volumes->listVolumes('Henry David Thoreau', $optParams);
+
+ foreach ($results as $item) {
+ echo $item['volumeInfo']['title'], "<br /> \n";
+ }
+```
+
+## Frequently Asked Questions ##
+
+### What do I do if something isn't working? ###
+
+For support with the library the best place to ask is via the google-api-php-client tag on StackOverflow: http://stackoverflow.com/questions/tagged/google-api-php-client
+
+If there is a specific bug with the library, please file a issue in the Github issues tracker, including a (minimal) example of the failing code and any specific errors retrieved. Feature requests can also be filed, as long as they are core library requests, and not-API specific: for those, refer to the documentation for the individual APIs for the best place to file requests. Please try to provide a clear statement of the problem that the feature would address.
+
+### How do I contribute? ###
+
+We accept contributions via Github Pull Requests, but all contributors need to be covered by the standard Google Contributor License Agreement. You can find links, and more instructions, in the documentation: https://developers.google.com/api-client-library/php/contribute
+
+### Why do you still support 5.2? ###
+
+When we started working on the 1.0.0 branch we knew there were several fundamental issues to fix with the 0.6 releases of the library. At that time we looked at the usage of the library, and other related projects, and determined that there was still a large and active base of PHP 5.2 installs. You can see this in statistics such as the PHP versions chart in the WordPress stats: http://wordpress.org/about/stats/. We will keep looking at the types of usage we see, and try to take advantage of newer PHP features where possible.
+
+### Why does Google_..._Service have weird names? ###
+
+The _Service classes are generally automatically generated from the API discovery documents: https://developers.google.com/discovery/. Sometimes new features are added to APIs with unusual names, which can cause some unexpected or non-standard style naming in the PHP classes.
+
+### How do I deal with non-JSON response types? ###
+
+Some services return XML or similar by default, rather than JSON, which is what the library supports. You can request a JSON response by adding an 'alt' argument to optional params that is normally the last argument to a method call:
+
+```
+$opt_params = array(
+ 'alt' => "json"
+);
+```
+
+## Code Quality ##
+
+Copy the ruleset.xml in style/ into a new directory named GAPI/ in your
+/usr/share/php/PHP/CodeSniffer/Standards (or appropriate equivalent directory),
+and run code sniffs with:
+
+ phpcs --standard=GAPI src/
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_Auth.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/Abstract.php
index 010782d4a60..0832df3a408 100644
--- a/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_Auth.php
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/Abstract.php
@@ -14,23 +14,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-require_once "Google_AuthNone.php";
-require_once "Google_OAuth2.php";
+require_once "Google/Http/Request.php";
/**
* Abstract class for the Authentication in the API client
* @author Chris Chabot <chabotc@google.com>
*
*/
-abstract class Google_Auth {
- abstract public function authenticate($service);
- abstract public function sign(Google_HttpRequest $request);
- abstract public function createAuthUrl($scope);
-
- abstract public function getAccessToken();
- abstract public function setAccessToken($accessToken);
- abstract public function setDeveloperKey($developerKey);
- abstract public function refreshToken($refreshToken);
- abstract public function revokeToken();
+abstract class Google_Auth_Abstract
+{
+ /**
+ * An utility function that first calls $this->auth->sign($request) and then
+ * executes makeRequest() on that signed request. Used for when a request
+ * should be authenticated
+ * @param Google_Http_Request $request
+ * @return Google_Http_Request $request
+ */
+ abstract public function authenticatedRequest(Google_Http_Request $request);
+ abstract public function sign(Google_Http_Request $request);
}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_AssertionCredentials.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/AssertionCredentials.php
index d9b4394ba38..3db0a779df3 100644
--- a/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_AssertionCredentials.php
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/AssertionCredentials.php
@@ -15,12 +15,17 @@
* limitations under the License.
*/
+require_once "Google/Auth/OAuth2.php";
+require_once "Google/Signer/P12.php";
+require_once "Google/Utils.php";
+
/**
* Credentials object used for OAuth 2.0 Signed JWT assertion grants.
*
* @author Chirag Shah <chirags@google.com>
*/
-class Google_AssertionCredentials {
+class Google_Auth_AssertionCredentials
+{
const MAX_TOKEN_LIFETIME_SECS = 3600;
public $serviceAccountName;
@@ -34,6 +39,7 @@ class Google_AssertionCredentials {
* @link http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-06
*/
public $prn;
+ private $useCache;
/**
* @param $serviceAccountName
@@ -42,8 +48,9 @@ class Google_AssertionCredentials {
* @param string $privateKeyPassword
* @param string $assertionType
* @param bool|string $sub The email address of the user for which the
- * application is requesting delegated access.
- *
+ * application is requesting delegated access.
+ * @param bool useCache Whether to generate a cache key and allow
+ * automatic caching of the generated token.
*/
public function __construct(
$serviceAccountName,
@@ -51,7 +58,9 @@ class Google_AssertionCredentials {
$privateKey,
$privateKeyPassword = 'notasecret',
$assertionType = 'http://oauth.net/grant_type/jwt/1.0/bearer',
- $sub = false) {
+ $sub = false,
+ $useCache = true
+ ) {
$this->serviceAccountName = $serviceAccountName;
$this->scopes = is_string($scopes) ? $scopes : implode(' ', $scopes);
$this->privateKey = $privateKey;
@@ -59,13 +68,32 @@ class Google_AssertionCredentials {
$this->assertionType = $assertionType;
$this->sub = $sub;
$this->prn = $sub;
+ $this->useCache = $useCache;
+ }
+
+ /**
+ * Generate a unique key to represent this credential.
+ * @return string
+ */
+ public function getCacheKey()
+ {
+ if (!$this->useCache) {
+ return false;
+ }
+ $h = $this->sub;
+ $h .= $this->assertionType;
+ $h .= $this->privateKey;
+ $h .= $this->scopes;
+ $h .= $this->serviceAccountName;
+ return md5($h);
}
- public function generateAssertion() {
+ public function generateAssertion()
+ {
$now = time();
$jwtParams = array(
- 'aud' => Google_OAuth2::OAUTH2_TOKEN_URI,
+ 'aud' => Google_Auth_OAuth2::OAUTH2_TOKEN_URI,
'scope' => $this->scopes,
'iat' => $now,
'exp' => $now + self::MAX_TOKEN_LIFETIME_SECS,
@@ -86,16 +114,22 @@ class Google_AssertionCredentials {
* @param array $payload
* @return string The signed JWT.
*/
- private function makeSignedJwt($payload) {
+ private function makeSignedJwt($payload)
+ {
$header = array('typ' => 'JWT', 'alg' => 'RS256');
+ $payload = json_encode($payload);
+ // Handle some overzealous escaping in PHP json that seemed to cause some errors
+ // with claimsets.
+ $payload = str_replace('\/', '/', $payload);
+
$segments = array(
Google_Utils::urlSafeB64Encode(json_encode($header)),
- Google_Utils::urlSafeB64Encode(json_encode($payload))
+ Google_Utils::urlSafeB64Encode($payload)
);
$signingInput = implode('.', $segments);
- $signer = new Google_P12Signer($this->privateKey, $this->privateKeyPassword);
+ $signer = new Google_Signer_P12($this->privateKey, $this->privateKeyPassword);
$signature = $signer->sign($signingInput);
$segments[] = Google_Utils::urlSafeB64Encode($signature);
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/Exception.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/Exception.php
new file mode 100644
index 00000000000..65067ee4436
--- /dev/null
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/Exception.php
@@ -0,0 +1,22 @@
+<?php
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+require_once "Google/Exception.php";
+
+class Google_Auth_Exception extends Google_Exception
+{
+}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_LoginTicket.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/LoginTicket.php
index c0ce614232b..bcf798ae5ff 100644
--- a/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_LoginTicket.php
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/LoginTicket.php
@@ -15,13 +15,16 @@
* limitations under the License.
*/
+require_once "Google/Auth/Exception.php";
+
/**
* Class to hold information about an authenticated login.
*
* @author Brian Eaton <beaton@google.com>
*/
-class Google_LoginTicket {
- const USER_ATTR = "id";
+class Google_Auth_LoginTicket
+{
+ const USER_ATTR = "sub";
// Information from id token envelope.
private $envelope;
@@ -35,21 +38,23 @@ class Google_LoginTicket {
* @param string $envelope Header from a verified authentication token.
* @param string $payload Information from a verified authentication token.
*/
- public function __construct($envelope, $payload) {
+ public function __construct($envelope, $payload)
+ {
$this->envelope = $envelope;
$this->payload = $payload;
}
/**
* Returns the numeric identifier for the user.
- * @throws Google_AuthException
+ * @throws Google_Auth_Exception
* @return
*/
- public function getUserId() {
+ public function getUserId()
+ {
if (array_key_exists(self::USER_ATTR, $this->payload)) {
return $this->payload[self::USER_ATTR];
}
- throw new Google_AuthException("No user_id in token");
+ throw new Google_Auth_Exception("No user_id in token");
}
/**
@@ -57,7 +62,8 @@ class Google_LoginTicket {
* various information about the user session.
* @return array
*/
- public function getAttributes() {
+ public function getAttributes()
+ {
return array("envelope" => $this->envelope, "payload" => $this->payload);
}
}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/OAuth2.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/OAuth2.php
new file mode 100644
index 00000000000..5630d755e04
--- /dev/null
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/OAuth2.php
@@ -0,0 +1,620 @@
+<?php
+/*
+ * Copyright 2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+require_once "Google/Auth/Abstract.php";
+require_once "Google/Auth/AssertionCredentials.php";
+require_once "Google/Auth/Exception.php";
+require_once "Google/Auth/LoginTicket.php";
+require_once "Google/Client.php";
+require_once "Google/Http/Request.php";
+require_once "Google/Utils.php";
+require_once "Google/Verifier/Pem.php";
+
+/**
+ * Authentication class that deals with the OAuth 2 web-server authentication flow
+ *
+ * @author Chris Chabot <chabotc@google.com>
+ * @author Chirag Shah <chirags@google.com>
+ *
+ */
+class Google_Auth_OAuth2 extends Google_Auth_Abstract
+{
+ const OAUTH2_REVOKE_URI = 'https://accounts.google.com/o/oauth2/revoke';
+ const OAUTH2_TOKEN_URI = 'https://accounts.google.com/o/oauth2/token';
+ const OAUTH2_AUTH_URL = 'https://accounts.google.com/o/oauth2/auth';
+ const CLOCK_SKEW_SECS = 300; // five minutes in seconds
+ const AUTH_TOKEN_LIFETIME_SECS = 300; // five minutes in seconds
+ const MAX_TOKEN_LIFETIME_SECS = 86400; // one day in seconds
+ const OAUTH2_ISSUER = 'accounts.google.com';
+
+ /** @var Google_Auth_AssertionCredentials $assertionCredentials */
+ private $assertionCredentials;
+
+ /**
+ * @var string The state parameters for CSRF and other forgery protection.
+ */
+ private $state;
+
+ /**
+ * @var array The token bundle.
+ */
+ private $token = array();
+
+ /**
+ * @var Google_Client the base client
+ */
+ private $client;
+
+ /**
+ * Instantiates the class, but does not initiate the login flow, leaving it
+ * to the discretion of the caller.
+ */
+ public function __construct(Google_Client $client)
+ {
+ $this->client = $client;
+ }
+
+ /**
+ * Perform an authenticated / signed apiHttpRequest.
+ * This function takes the apiHttpRequest, calls apiAuth->sign on it
+ * (which can modify the request in what ever way fits the auth mechanism)
+ * and then calls apiCurlIO::makeRequest on the signed request
+ *
+ * @param Google_Http_Request $request
+ * @return Google_Http_Request The resulting HTTP response including the
+ * responseHttpCode, responseHeaders and responseBody.
+ */
+ public function authenticatedRequest(Google_Http_Request $request)
+ {
+ $request = $this->sign($request);
+ return $this->client->getIo()->makeRequest($request);
+ }
+
+ /**
+ * @param string $code
+ * @throws Google_Auth_Exception
+ * @return string
+ */
+ public function authenticate($code)
+ {
+ if (strlen($code) == 0) {
+ throw new Google_Auth_Exception("Invalid code");
+ }
+
+ // We got here from the redirect from a successful authorization grant,
+ // fetch the access token
+ $request = new Google_Http_Request(
+ self::OAUTH2_TOKEN_URI,
+ 'POST',
+ array(),
+ array(
+ 'code' => $code,
+ 'grant_type' => 'authorization_code',
+ 'redirect_uri' => $this->client->getClassConfig($this, 'redirect_uri'),
+ 'client_id' => $this->client->getClassConfig($this, 'client_id'),
+ 'client_secret' => $this->client->getClassConfig($this, 'client_secret')
+ )
+ );
+ $request->disableGzip();
+ $response = $this->client->getIo()->makeRequest($request);
+
+ if ($response->getResponseHttpCode() == 200) {
+ $this->setAccessToken($response->getResponseBody());
+ $this->token['created'] = time();
+ return $this->getAccessToken();
+ } else {
+ $decodedResponse = json_decode($response->getResponseBody(), true);
+ if ($decodedResponse != null && $decodedResponse['error']) {
+ $decodedResponse = $decodedResponse['error'];
+ if (isset($decodedResponse['error_description'])) {
+ $decodedResponse .= ": " . $decodedResponse['error_description'];
+ }
+ }
+ throw new Google_Auth_Exception(
+ sprintf(
+ "Error fetching OAuth2 access token, message: '%s'",
+ $decodedResponse
+ ),
+ $response->getResponseHttpCode()
+ );
+ }
+ }
+
+ /**
+ * Create a URL to obtain user authorization.
+ * The authorization endpoint allows the user to first
+ * authenticate, and then grant/deny the access request.
+ * @param string $scope The scope is expressed as a list of space-delimited strings.
+ * @return string
+ */
+ public function createAuthUrl($scope)
+ {
+ $params = array(
+ 'response_type' => 'code',
+ 'redirect_uri' => $this->client->getClassConfig($this, 'redirect_uri'),
+ 'client_id' => $this->client->getClassConfig($this, 'client_id'),
+ 'scope' => $scope,
+ 'access_type' => $this->client->getClassConfig($this, 'access_type'),
+ );
+
+ $params = $this->maybeAddParam($params, 'approval_prompt');
+ $params = $this->maybeAddParam($params, 'login_hint');
+ $params = $this->maybeAddParam($params, 'hd');
+ $params = $this->maybeAddParam($params, 'openid.realm');
+ $params = $this->maybeAddParam($params, 'prompt');
+ $params = $this->maybeAddParam($params, 'include_granted_scopes');
+
+ // If the list of scopes contains plus.login, add request_visible_actions
+ // to auth URL.
+ $rva = $this->client->getClassConfig($this, 'request_visible_actions');
+ if (strpos($scope, 'plus.login') && strlen($rva) > 0) {
+ $params['request_visible_actions'] = $rva;
+ }
+
+ if (isset($this->state)) {
+ $params['state'] = $this->state;
+ }
+
+ return self::OAUTH2_AUTH_URL . "?" . http_build_query($params, '', '&');
+ }
+
+ /**
+ * @param string $token
+ * @throws Google_Auth_Exception
+ */
+ public function setAccessToken($token)
+ {
+ $token = json_decode($token, true);
+ if ($token == null) {
+ throw new Google_Auth_Exception('Could not json decode the token');
+ }
+ if (! isset($token['access_token'])) {
+ throw new Google_Auth_Exception("Invalid token format");
+ }
+ $this->token = $token;
+ }
+
+ public function getAccessToken()
+ {
+ return json_encode($this->token);
+ }
+
+ public function getRefreshToken()
+ {
+ if (array_key_exists('refresh_token', $this->token)) {
+ return $this->token['refresh_token'];
+ } else {
+ return null;
+ }
+ }
+
+ public function setState($state)
+ {
+ $this->state = $state;
+ }
+
+ public function setAssertionCredentials(Google_Auth_AssertionCredentials $creds)
+ {
+ $this->assertionCredentials = $creds;
+ }
+
+ /**
+ * Include an accessToken in a given apiHttpRequest.
+ * @param Google_Http_Request $request
+ * @return Google_Http_Request
+ * @throws Google_Auth_Exception
+ */
+ public function sign(Google_Http_Request $request)
+ {
+ // add the developer key to the request before signing it
+ if ($this->client->getClassConfig($this, 'developer_key')) {
+ $request->setQueryParam('key', $this->client->getClassConfig($this, 'developer_key'));
+ }
+
+ // Cannot sign the request without an OAuth access token.
+ if (null == $this->token && null == $this->assertionCredentials) {
+ return $request;
+ }
+
+ // Check if the token is set to expire in the next 30 seconds
+ // (or has already expired).
+ if ($this->isAccessTokenExpired()) {
+ if ($this->assertionCredentials) {
+ $this->refreshTokenWithAssertion();
+ } else {
+ if (! array_key_exists('refresh_token', $this->token)) {
+ throw new Google_Auth_Exception(
+ "The OAuth 2.0 access token has expired,"
+ ." and a refresh token is not available. Refresh tokens"
+ ." are not returned for responses that were auto-approved."
+ );
+ }
+ $this->refreshToken($this->token['refresh_token']);
+ }
+ }
+
+ // Add the OAuth2 header to the request
+ $request->setRequestHeaders(
+ array('Authorization' => 'Bearer ' . $this->token['access_token'])
+ );
+
+ return $request;
+ }
+
+ /**
+ * Fetches a fresh access token with the given refresh token.
+ * @param string $refreshToken
+ * @return void
+ */
+ public function refreshToken($refreshToken)
+ {
+ $this->refreshTokenRequest(
+ array(
+ 'client_id' => $this->client->getClassConfig($this, 'client_id'),
+ 'client_secret' => $this->client->getClassConfig($this, 'client_secret'),
+ 'refresh_token' => $refreshToken,
+ 'grant_type' => 'refresh_token'
+ )
+ );
+ }
+
+ /**
+ * Fetches a fresh access token with a given assertion token.
+ * @param Google_Auth_AssertionCredentials $assertionCredentials optional.
+ * @return void
+ */
+ public function refreshTokenWithAssertion($assertionCredentials = null)
+ {
+ if (!$assertionCredentials) {
+ $assertionCredentials = $this->assertionCredentials;
+ }
+
+ $cacheKey = $assertionCredentials->getCacheKey();
+
+ if ($cacheKey) {
+ // We can check whether we have a token available in the
+ // cache. If it is expired, we can retrieve a new one from
+ // the assertion.
+ $token = $this->client->getCache()->get($cacheKey);
+ if ($token) {
+ $this->setAccessToken($token);
+ }
+ if (!$this->isAccessTokenExpired()) {
+ return;
+ }
+ }
+
+ $this->refreshTokenRequest(
+ array(
+ 'grant_type' => 'assertion',
+ 'assertion_type' => $assertionCredentials->assertionType,
+ 'assertion' => $assertionCredentials->generateAssertion(),
+ )
+ );
+
+ if ($cacheKey) {
+ // Attempt to cache the token.
+ $this->client->getCache()->set(
+ $cacheKey,
+ $this->getAccessToken()
+ );
+ }
+ }
+
+ private function refreshTokenRequest($params)
+ {
+ $http = new Google_Http_Request(
+ self::OAUTH2_TOKEN_URI,
+ 'POST',
+ array(),
+ $params
+ );
+ $http->disableGzip();
+ $request = $this->client->getIo()->makeRequest($http);
+
+ $code = $request->getResponseHttpCode();
+ $body = $request->getResponseBody();
+ if (200 == $code) {
+ $token = json_decode($body, true);
+ if ($token == null) {
+ throw new Google_Auth_Exception("Could not json decode the access token");
+ }
+
+ if (! isset($token['access_token']) || ! isset($token['expires_in'])) {
+ throw new Google_Auth_Exception("Invalid token format");
+ }
+
+ if (isset($token['id_token'])) {
+ $this->token['id_token'] = $token['id_token'];
+ }
+ $this->token['access_token'] = $token['access_token'];
+ $this->token['expires_in'] = $token['expires_in'];
+ $this->token['created'] = time();
+ } else {
+ throw new Google_Auth_Exception("Error refreshing the OAuth2 token, message: '$body'", $code);
+ }
+ }
+
+ /**
+ * Revoke an OAuth2 access token or refresh token. This method will revoke the current access
+ * token, if a token isn't provided.
+ * @throws Google_Auth_Exception
+ * @param string|null $token The token (access token or a refresh token) that should be revoked.
+ * @return boolean Returns True if the revocation was successful, otherwise False.
+ */
+ public function revokeToken($token = null)
+ {
+ if (!$token) {
+ if (!$this->token) {
+ // Not initialized, no token to actually revoke
+ return false;
+ } elseif (array_key_exists('refresh_token', $this->token)) {
+ $token = $this->token['refresh_token'];
+ } else {
+ $token = $this->token['access_token'];
+ }
+ }
+ $request = new Google_Http_Request(
+ self::OAUTH2_REVOKE_URI,
+ 'POST',
+ array(),
+ "token=$token"
+ );
+ $request->disableGzip();
+ $response = $this->client->getIo()->makeRequest($request);
+ $code = $response->getResponseHttpCode();
+ if ($code == 200) {
+ $this->token = null;
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Returns if the access_token is expired.
+ * @return bool Returns True if the access_token is expired.
+ */
+ public function isAccessTokenExpired()
+ {
+ if (!$this->token || !isset($this->token['created'])) {
+ return true;
+ }
+
+ // If the token is set to expire in the next 30 seconds.
+ $expired = ($this->token['created']
+ + ($this->token['expires_in'] - 30)) < time();
+
+ return $expired;
+ }
+
+ // Gets federated sign-on certificates to use for verifying identity tokens.
+ // Returns certs as array structure, where keys are key ids, and values
+ // are PEM encoded certificates.
+ private function getFederatedSignOnCerts()
+ {
+ return $this->retrieveCertsFromLocation(
+ $this->client->getClassConfig($this, 'federated_signon_certs_url')
+ );
+ }
+
+ /**
+ * Retrieve and cache a certificates file.
+ * @param $url location
+ * @return array certificates
+ */
+ public function retrieveCertsFromLocation($url)
+ {
+ // If we're retrieving a local file, just grab it.
+ if ("http" != substr($url, 0, 4)) {
+ $file = file_get_contents($url);
+ if ($file) {
+ return json_decode($file, true);
+ } else {
+ throw new Google_Auth_Exception(
+ "Failed to retrieve verification certificates: '" .
+ $url . "'."
+ );
+ }
+ }
+
+ // This relies on makeRequest caching certificate responses.
+ $request = $this->client->getIo()->makeRequest(
+ new Google_Http_Request(
+ $url
+ )
+ );
+ if ($request->getResponseHttpCode() == 200) {
+ $certs = json_decode($request->getResponseBody(), true);
+ if ($certs) {
+ return $certs;
+ }
+ }
+ throw new Google_Auth_Exception(
+ "Failed to retrieve verification certificates: '" .
+ $request->getResponseBody() . "'.",
+ $request->getResponseHttpCode()
+ );
+ }
+
+ /**
+ * Verifies an id token and returns the authenticated apiLoginTicket.
+ * Throws an exception if the id token is not valid.
+ * The audience parameter can be used to control which id tokens are
+ * accepted. By default, the id token must have been issued to this OAuth2 client.
+ *
+ * @param $id_token
+ * @param $audience
+ * @return Google_Auth_LoginTicket
+ */
+ public function verifyIdToken($id_token = null, $audience = null)
+ {
+ if (!$id_token) {
+ $id_token = $this->token['id_token'];
+ }
+ $certs = $this->getFederatedSignonCerts();
+ if (!$audience) {
+ $audience = $this->client->getClassConfig($this, 'client_id');
+ }
+
+ return $this->verifySignedJwtWithCerts($id_token, $certs, $audience, self::OAUTH2_ISSUER);
+ }
+
+ /**
+ * Verifies the id token, returns the verified token contents.
+ *
+ * @param $jwt the token
+ * @param $certs array of certificates
+ * @param $required_audience the expected consumer of the token
+ * @param [$issuer] the expected issues, defaults to Google
+ * @param [$max_expiry] the max lifetime of a token, defaults to MAX_TOKEN_LIFETIME_SECS
+ * @return token information if valid, false if not
+ */
+ public function verifySignedJwtWithCerts(
+ $jwt,
+ $certs,
+ $required_audience,
+ $issuer = null,
+ $max_expiry = null
+ ) {
+ if (!$max_expiry) {
+ // Set the maximum time we will accept a token for.
+ $max_expiry = self::MAX_TOKEN_LIFETIME_SECS;
+ }
+
+ $segments = explode(".", $jwt);
+ if (count($segments) != 3) {
+ throw new Google_Auth_Exception("Wrong number of segments in token: $jwt");
+ }
+ $signed = $segments[0] . "." . $segments[1];
+ $signature = Google_Utils::urlSafeB64Decode($segments[2]);
+
+ // Parse envelope.
+ $envelope = json_decode(Google_Utils::urlSafeB64Decode($segments[0]), true);
+ if (!$envelope) {
+ throw new Google_Auth_Exception("Can't parse token envelope: " . $segments[0]);
+ }
+
+ // Parse token
+ $json_body = Google_Utils::urlSafeB64Decode($segments[1]);
+ $payload = json_decode($json_body, true);
+ if (!$payload) {
+ throw new Google_Auth_Exception("Can't parse token payload: " . $segments[1]);
+ }
+
+ // Check signature
+ $verified = false;
+ foreach ($certs as $keyName => $pem) {
+ $public_key = new Google_Verifier_Pem($pem);
+ if ($public_key->verify($signed, $signature)) {
+ $verified = true;
+ break;
+ }
+ }
+
+ if (!$verified) {
+ throw new Google_Auth_Exception("Invalid token signature: $jwt");
+ }
+
+ // Check issued-at timestamp
+ $iat = 0;
+ if (array_key_exists("iat", $payload)) {
+ $iat = $payload["iat"];
+ }
+ if (!$iat) {
+ throw new Google_Auth_Exception("No issue time in token: $json_body");
+ }
+ $earliest = $iat - self::CLOCK_SKEW_SECS;
+
+ // Check expiration timestamp
+ $now = time();
+ $exp = 0;
+ if (array_key_exists("exp", $payload)) {
+ $exp = $payload["exp"];
+ }
+ if (!$exp) {
+ throw new Google_Auth_Exception("No expiration time in token: $json_body");
+ }
+ if ($exp >= $now + $max_expiry) {
+ throw new Google_Auth_Exception(
+ sprintf("Expiration time too far in future: %s", $json_body)
+ );
+ }
+
+ $latest = $exp + self::CLOCK_SKEW_SECS;
+ if ($now < $earliest) {
+ throw new Google_Auth_Exception(
+ sprintf(
+ "Token used too early, %s < %s: %s",
+ $now,
+ $earliest,
+ $json_body
+ )
+ );
+ }
+ if ($now > $latest) {
+ throw new Google_Auth_Exception(
+ sprintf(
+ "Token used too late, %s > %s: %s",
+ $now,
+ $latest,
+ $json_body
+ )
+ );
+ }
+
+ $iss = $payload['iss'];
+ if ($issuer && $iss != $issuer) {
+ throw new Google_Auth_Exception(
+ sprintf(
+ "Invalid issuer, %s != %s: %s",
+ $iss,
+ $issuer,
+ $json_body
+ )
+ );
+ }
+
+ // Check audience
+ $aud = $payload["aud"];
+ if ($aud != $required_audience) {
+ throw new Google_Auth_Exception(
+ sprintf(
+ "Wrong recipient, %s != %s:",
+ $aud,
+ $required_audience,
+ $json_body
+ )
+ );
+ }
+
+ // All good.
+ return new Google_Auth_LoginTicket($envelope, $payload);
+ }
+
+ /**
+ * Add a parameter to the auth params if not empty string.
+ */
+ private function maybeAddParam($params, $name)
+ {
+ $param = $this->client->getClassConfig($this, $name);
+ if ($param != '') {
+ $params[$name] = $param;
+ }
+ return $params;
+ }
+}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/Simple.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/Simple.php
new file mode 100644
index 00000000000..e83900fc26f
--- /dev/null
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Auth/Simple.php
@@ -0,0 +1,62 @@
+<?php
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+require_once "Google/Auth/Abstract.php";
+require_once "Google/Http/Request.php";
+
+/**
+ * Simple API access implementation. Can either be used to make requests
+ * completely unauthenticated, or by using a Simple API Access developer
+ * key.
+ * @author Chris Chabot <chabotc@google.com>
+ * @author Chirag Shah <chirags@google.com>
+ */
+class Google_Auth_Simple extends Google_Auth_Abstract
+{
+ private $key = null;
+ private $client;
+
+ public function __construct(Google_Client $client, $config = null)
+ {
+ $this->client = $client;
+ }
+
+ /**
+ * Perform an authenticated / signed apiHttpRequest.
+ * This function takes the apiHttpRequest, calls apiAuth->sign on it
+ * (which can modify the request in what ever way fits the auth mechanism)
+ * and then calls apiCurlIO::makeRequest on the signed request
+ *
+ * @param Google_Http_Request $request
+ * @return Google_Http_Request The resulting HTTP response including the
+ * responseHttpCode, responseHeaders and responseBody.
+ */
+ public function authenticatedRequest(Google_Http_Request $request)
+ {
+ $request = $this->sign($request);
+ return $this->io->makeRequest($request);
+ }
+
+ public function sign(Google_Http_Request $request)
+ {
+ $key = $this->client->getClassConfig($this, 'developer_key');
+ if ($key) {
+ $request->setQueryParam('key', $key);
+ }
+ return $request;
+ }
+}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/cache/Google_Cache.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Cache/Abstract.php
index 809c55e2b15..ff19f36ac46 100644
--- a/apps/files_external/3rdparty/google-api-php-client/src/cache/Google_Cache.php
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Cache/Abstract.php
@@ -15,15 +15,15 @@
* limitations under the License.
*/
-require_once "Google_FileCache.php";
-require_once "Google_MemcacheCache.php";
-
/**
* Abstract storage class
*
* @author Chris Chabot <chabotc@google.com>
*/
-abstract class Google_Cache {
+abstract class Google_Cache_Abstract
+{
+
+ abstract public function __construct(Google_Client $client);
/**
* Retrieves the data for the given key, or false if they
@@ -33,7 +33,7 @@ abstract class Google_Cache {
* @param boolean|int $expiration Expiration time in seconds
*
*/
- abstract function get($key, $expiration = false);
+ abstract public function get($key, $expiration = false);
/**
* Store the key => $value set. The $value is serialized
@@ -42,14 +42,12 @@ abstract class Google_Cache {
* @param string $key Key of the data
* @param string $value data
*/
- abstract function set($key, $value);
+ abstract public function set($key, $value);
/**
* Removes the key/data pair for the given $key
*
* @param String $key
*/
- abstract function delete($key);
+ abstract public function delete($key);
}
-
-
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Cache/Apc.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Cache/Apc.php
new file mode 100644
index 00000000000..051b537a4e1
--- /dev/null
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Cache/Apc.php
@@ -0,0 +1,73 @@
+<?php
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+require_once "Google/Cache/Abstract.php";
+require_once "Google/Cache/Exception.php";
+
+/**
+ * A persistent storage class based on the APC cache, which is not
+ * really very persistent, as soon as you restart your web server
+ * the storage will be wiped, however for debugging and/or speed
+ * it can be useful, and cache is a lot cheaper then storage.
+ *
+ * @author Chris Chabot <chabotc@google.com>
+ */
+class Google_Cache_Apc extends Google_Cache_Abstract
+{
+ public function __construct(Google_Client $client)
+ {
+ if (! function_exists('apc_add') ) {
+ throw new Google_Cache_Exception("Apc functions not available");
+ }
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function get($key, $expiration = false)
+ {
+ $ret = apc_fetch($key);
+ if ($ret === false) {
+ return false;
+ }
+ if (is_numeric($expiration) && (time() - $ret['time'] > $expiration)) {
+ $this->delete($key);
+ return false;
+ }
+ return $ret['data'];
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function set($key, $value)
+ {
+ $rc = apc_store($key, array('time' => time(), 'data' => $value));
+ if ($rc == false) {
+ throw new Google_Cache_Exception("Couldn't store data");
+ }
+ }
+
+ /**
+ * @inheritDoc
+ * @param String $key
+ */
+ public function delete($key)
+ {
+ apc_delete($key);
+ }
+}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Cache/Exception.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Cache/Exception.php
new file mode 100644
index 00000000000..23b624608e8
--- /dev/null
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Cache/Exception.php
@@ -0,0 +1,21 @@
+<?php
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+require_once "Google/Exception.php";
+
+class Google_Cache_Exception extends Google_Exception
+{
+}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Cache/File.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Cache/File.php
new file mode 100644
index 00000000000..8d0d62fe88c
--- /dev/null
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Cache/File.php
@@ -0,0 +1,145 @@
+<?php
+/*
+ * Copyright 2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+require_once "Google/Cache/Abstract.php";
+require_once "Google/Cache/Exception.php";
+
+/*
+ * This class implements a basic on disk storage. While that does
+ * work quite well it's not the most elegant and scalable solution.
+ * It will also get you into a heap of trouble when you try to run
+ * this in a clustered environment.
+ *
+ * @author Chris Chabot <chabotc@google.com>
+ */
+class Google_Cache_File extends Google_Cache_Abstract
+{
+ const MAX_LOCK_RETRIES = 10;
+ private $path;
+ private $fh;
+
+ public function __construct(Google_Client $client)
+ {
+ $this->path = $client->getClassConfig($this, 'directory');
+ }
+
+ public function get($key, $expiration = false)
+ {
+ $storageFile = $this->getCacheFile($key);
+ $data = false;
+
+ if (!file_exists($storageFile)) {
+ return false;
+ }
+
+ if ($expiration) {
+ $mtime = filemtime($storageFile);
+ if ((time() - $mtime) >= $expiration) {
+ $this->delete($key);
+ return false;
+ }
+ }
+
+ if ($this->acquireReadLock($storageFile)) {
+ $data = fread($this->fh, filesize($storageFile));
+ $data = unserialize($data);
+ $this->unlock($storageFile);
+ }
+
+ return $data;
+ }
+
+ public function set($key, $value)
+ {
+ $storageFile = $this->getWriteableCacheFile($key);
+ if ($this->acquireWriteLock($storageFile)) {
+ // We serialize the whole request object, since we don't only want the
+ // responseContent but also the postBody used, headers, size, etc.
+ $data = serialize($value);
+ $result = fwrite($this->fh, $data);
+ $this->unlock($storageFile);
+ }
+ }
+
+ public function delete($key)
+ {
+ $file = $this->getCacheFile($key);
+ if (file_exists($file) && !unlink($file)) {
+ throw new Google_Cache_Exception("Cache file could not be deleted");
+ }
+ }
+
+ private function getWriteableCacheFile($file)
+ {
+ return $this->getCacheFile($file, true);
+ }
+
+ private function getCacheFile($file, $forWrite = false)
+ {
+ return $this->getCacheDir($file, $forWrite) . '/' . md5($file);
+ }
+
+ private function getCacheDir($file, $forWrite)
+ {
+ // use the first 2 characters of the hash as a directory prefix
+ // this should prevent slowdowns due to huge directory listings
+ // and thus give some basic amount of scalability
+ $storageDir = $this->path . '/' . substr(md5($file), 0, 2);
+ if ($forWrite && ! is_dir($storageDir)) {
+ if (! mkdir($storageDir, 0755, true)) {
+ throw new Google_Cache_Exception("Could not create storage directory: $storageDir");
+ }
+ }
+ return $storageDir;
+ }
+
+ private function acquireReadLock($storageFile)
+ {
+ return $this->acquireLock(LOCK_SH, $storageFile);
+ }
+
+ private function acquireWriteLock($storageFile)
+ {
+ $rc = $this->acquireLock(LOCK_EX, $storageFile);
+ if (!$rc) {
+ $this->delete($storageFile);
+ }
+ return $rc;
+ }
+
+ private function acquireLock($type, $storageFile)
+ {
+ $mode = $type == LOCK_EX ? "w" : "r";
+ $this->fh = fopen($storageFile, $mode);
+ $count = 0;
+ while (!flock($this->fh, $type | LOCK_NB)) {
+ // Sleep for 10ms.
+ usleep(10000);
+ if (++$count < self::MAX_LOCK_RETRIES) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public function unlock($storageFile)
+ {
+ if ($this->fh) {
+ flock($this->fh, LOCK_UN);
+ }
+ }
+}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Cache/Memcache.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Cache/Memcache.php
new file mode 100644
index 00000000000..1104afb8aeb
--- /dev/null
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Cache/Memcache.php
@@ -0,0 +1,137 @@
+<?php
+/*
+ * Copyright 2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+require_once "Google/Cache/Abstract.php";
+require_once "Google/Cache/Exception.php";
+
+/**
+ * A persistent storage class based on the memcache, which is not
+ * really very persistent, as soon as you restart your memcache daemon
+ * the storage will be wiped.
+ *
+ * Will use either the memcache or memcached extensions, preferring
+ * memcached.
+ *
+ * @author Chris Chabot <chabotc@google.com>
+ */
+class Google_Cache_Memcache extends Google_Cache_Abstract
+{
+ private $connection = false;
+ private $mc = false;
+ private $host;
+ private $port;
+
+ public function __construct(Google_Client $client)
+ {
+ if (!function_exists('memcache_connect') && !class_exists("Memcached")) {
+ throw new Google_Cache_Exception("Memcache functions not available");
+ }
+ if ($client->isAppEngine()) {
+ // No credentials needed for GAE.
+ $this->mc = new Memcached();
+ $this->connection = true;
+ } else {
+ $this->host = $client->getClassConfig($this, 'host');
+ $this->port = $client->getClassConfig($this, 'port');
+ if (empty($this->host) || (empty($this->port) && (string) $this->port != "0")) {
+ throw new Google_Cache_Exception("You need to supply a valid memcache host and port");
+ }
+ }
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function get($key, $expiration = false)
+ {
+ $this->connect();
+ $ret = false;
+ if ($this->mc) {
+ $ret = $this->mc->get($key);
+ } else {
+ $ret = memcache_get($this->connection, $key);
+ }
+ if ($ret === false) {
+ return false;
+ }
+ if (is_numeric($expiration) && (time() - $ret['time'] > $expiration)) {
+ $this->delete($key);
+ return false;
+ }
+ return $ret['data'];
+ }
+
+ /**
+ * @inheritDoc
+ * @param string $key
+ * @param string $value
+ * @throws Google_Cache_Exception
+ */
+ public function set($key, $value)
+ {
+ $this->connect();
+ // we store it with the cache_time default expiration so objects will at
+ // least get cleaned eventually.
+ $data = array('time' => time(), 'data' => $value);
+ $rc = false;
+ if ($this->mc) {
+ $rc = $this->mc->set($key, $data);
+ } else {
+ $rc = memcache_set($this->connection, $key, $data, false);
+ }
+ if ($rc == false) {
+ throw new Google_Cache_Exception("Couldn't store data in cache");
+ }
+ }
+
+ /**
+ * @inheritDoc
+ * @param String $key
+ */
+ public function delete($key)
+ {
+ $this->connect();
+ if ($this->mc) {
+ $this->mc->delete($key, 0);
+ } else {
+ memcache_delete($this->connection, $key, 0);
+ }
+ }
+
+ /**
+ * Lazy initialiser for memcache connection. Uses pconnect for to take
+ * advantage of the persistence pool where possible.
+ */
+ private function connect()
+ {
+ if ($this->connection) {
+ return;
+ }
+
+ if (class_exists("Memcached")) {
+ $this->mc = new Memcached();
+ $this->mc->addServer($this->host, $this->port);
+ $this->connection = true;
+ } else {
+ $this->connection = memcache_pconnect($this->host, $this->port);
+ }
+
+ if (! $this->connection) {
+ throw new Google_Cache_Exception("Couldn't connect to memcache server");
+ }
+ }
+}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Client.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Client.php
new file mode 100644
index 00000000000..e15b4f4ea3c
--- /dev/null
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Client.php
@@ -0,0 +1,665 @@
+<?php
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+require_once 'Google/Auth/AssertionCredentials.php';
+require_once 'Google/Cache/File.php';
+require_once 'Google/Cache/Memcache.php';
+require_once 'Google/Config.php';
+require_once 'Google/Collection.php';
+require_once 'Google/Exception.php';
+require_once 'Google/IO/Curl.php';
+require_once 'Google/IO/Stream.php';
+require_once 'Google/Model.php';
+require_once 'Google/Service.php';
+require_once 'Google/Service/Resource.php';
+
+/**
+ * The Google API Client
+ * http://code.google.com/p/google-api-php-client/
+ *
+ * @author Chris Chabot <chabotc@google.com>
+ * @author Chirag Shah <chirags@google.com>
+ */
+class Google_Client
+{
+ const LIBVER = "1.0.6-beta";
+ const USER_AGENT_SUFFIX = "google-api-php-client/";
+ /**
+ * @var Google_Auth_Abstract $auth
+ */
+ private $auth;
+
+ /**
+ * @var Google_IO_Abstract $io
+ */
+ private $io;
+
+ /**
+ * @var Google_Cache_Abstract $cache
+ */
+ private $cache;
+
+ /**
+ * @var Google_Config $config
+ */
+ private $config;
+
+ /**
+ * @var boolean $deferExecution
+ */
+ private $deferExecution = false;
+
+ /** @var array $scopes */
+ // Scopes requested by the client
+ protected $requestedScopes = array();
+
+ // definitions of services that are discovered.
+ protected $services = array();
+
+ // Used to track authenticated state, can't discover services after doing authenticate()
+ private $authenticated = false;
+
+ /**
+ * Construct the Google Client.
+ *
+ * @param $config Google_Config or string for the ini file to load
+ */
+ public function __construct($config = null)
+ {
+ if (is_string($config) && strlen($config)) {
+ $config = new Google_Config($config);
+ } else if ( !($config instanceof Google_Config)) {
+ $config = new Google_Config();
+
+ if ($this->isAppEngine()) {
+ // Automatically use Memcache if we're in AppEngine.
+ $config->setCacheClass('Google_Cache_Memcache');
+ }
+
+ if (version_compare(phpversion(), "5.3.4", "<=") || $this->isAppEngine()) {
+ // Automatically disable compress.zlib, as currently unsupported.
+ $config->setClassConfig('Google_Http_Request', 'disable_gzip', true);
+ }
+ }
+
+ if ($config->getIoClass() == Google_Config::USE_AUTO_IO_SELECTION) {
+ if (function_exists('curl_version') && function_exists('curl_exec')) {
+ $config->setIoClass("Google_IO_Curl");
+ } else {
+ $config->setIoClass("Google_IO_Stream");
+ }
+ }
+
+ $this->config = $config;
+ }
+
+ /**
+ * Get a string containing the version of the library.
+ *
+ * @return string
+ */
+ public function getLibraryVersion()
+ {
+ return self::LIBVER;
+ }
+
+ /**
+ * Attempt to exchange a code for an valid authentication token.
+ * Helper wrapped around the OAuth 2.0 implementation.
+ *
+ * @param $code string code from accounts.google.com
+ * @return string token
+ */
+ public function authenticate($code)
+ {
+ $this->authenticated = true;
+ return $this->getAuth()->authenticate($code);
+ }
+
+ /**
+ * Set the auth config from the JSON string provided.
+ * This structure should match the file downloaded from
+ * the "Download JSON" button on in the Google Developer
+ * Console.
+ * @param string $json the configuration json
+ */
+ public function setAuthConfig($json)
+ {
+ $data = json_decode($json);
+ $key = isset($data->installed) ? 'installed' : 'web';
+ if (!isset($data->$key)) {
+ throw new Google_Exception("Invalid client secret JSON file.");
+ }
+ $this->setClientId($data->$key->client_id);
+ $this->setClientSecret($data->$key->client_secret);
+ if (isset($data->$key->redirect_uris)) {
+ $this->setRedirectUri($data->$key->redirect_uris[0]);
+ }
+ }
+
+ /**
+ * Set the auth config from the JSON file in the path
+ * provided. This should match the file downloaded from
+ * the "Download JSON" button on in the Google Developer
+ * Console.
+ * @param string $file the file location of the client json
+ */
+ public function setAuthConfigFile($file)
+ {
+ $this->setAuthConfig(file_get_contents($file));
+ }
+
+ /**
+ * @return array
+ * @visible For Testing
+ */
+ public function prepareScopes()
+ {
+ if (empty($this->requestedScopes)) {
+ throw new Google_Auth_Exception("No scopes specified");
+ }
+ $scopes = implode(' ', $this->requestedScopes);
+ return $scopes;
+ }
+
+ /**
+ * Set the OAuth 2.0 access token using the string that resulted from calling createAuthUrl()
+ * or Google_Client#getAccessToken().
+ * @param string $accessToken JSON encoded string containing in the following format:
+ * {"access_token":"TOKEN", "refresh_token":"TOKEN", "token_type":"Bearer",
+ * "expires_in":3600, "id_token":"TOKEN", "created":1320790426}
+ */
+ public function setAccessToken($accessToken)
+ {
+ if ($accessToken == 'null') {
+ $accessToken = null;
+ }
+ $this->getAuth()->setAccessToken($accessToken);
+ }
+
+
+
+ /**
+ * Set the authenticator object
+ * @param Google_Auth_Abstract $auth
+ */
+ public function setAuth(Google_Auth_Abstract $auth)
+ {
+ $this->config->setAuthClass(get_class($auth));
+ $this->auth = $auth;
+ }
+
+ /**
+ * Set the IO object
+ * @param Google_Io_Abstract $auth
+ */
+ public function setIo(Google_Io_Abstract $io)
+ {
+ $this->config->setIoClass(get_class($io));
+ $this->io = $io;
+ }
+
+ /**
+ * Set the Cache object
+ * @param Google_Cache_Abstract $auth
+ */
+ public function setCache(Google_Cache_Abstract $cache)
+ {
+ $this->config->setCacheClass(get_class($cache));
+ $this->cache = $cache;
+ }
+
+ /**
+ * Construct the OAuth 2.0 authorization request URI.
+ * @return string
+ */
+ public function createAuthUrl()
+ {
+ $scopes = $this->prepareScopes();
+ return $this->getAuth()->createAuthUrl($scopes);
+ }
+
+ /**
+ * Get the OAuth 2.0 access token.
+ * @return string $accessToken JSON encoded string in the following format:
+ * {"access_token":"TOKEN", "refresh_token":"TOKEN", "token_type":"Bearer",
+ * "expires_in":3600,"id_token":"TOKEN", "created":1320790426}
+ */
+ public function getAccessToken()
+ {
+ $token = $this->getAuth()->getAccessToken();
+ // The response is json encoded, so could be the string null.
+ // It is arguable whether this check should be here or lower
+ // in the library.
+ return (null == $token || 'null' == $token || '[]' == $token) ? null : $token;
+ }
+
+ /**
+ * Get the OAuth 2.0 refresh token.
+ * @return string $refreshToken refresh token or null if not available
+ */
+ public function getRefreshToken()
+ {
+ return $this->getAuth()->getRefreshToken();
+ }
+
+ /**
+ * Returns if the access_token is expired.
+ * @return bool Returns True if the access_token is expired.
+ */
+ public function isAccessTokenExpired()
+ {
+ return $this->getAuth()->isAccessTokenExpired();
+ }
+
+ /**
+ * Set OAuth 2.0 "state" parameter to achieve per-request customization.
+ * @see http://tools.ietf.org/html/draft-ietf-oauth-v2-22#section-3.1.2.2
+ * @param string $state
+ */
+ public function setState($state)
+ {
+ $this->getAuth()->setState($state);
+ }
+
+ /**
+ * @param string $accessType Possible values for access_type include:
+ * {@code "offline"} to request offline access from the user.
+ * {@code "online"} to request online access from the user.
+ */
+ public function setAccessType($accessType)
+ {
+ $this->config->setAccessType($accessType);
+ }
+
+ /**
+ * @param string $approvalPrompt Possible values for approval_prompt include:
+ * {@code "force"} to force the approval UI to appear. (This is the default value)
+ * {@code "auto"} to request auto-approval when possible.
+ */
+ public function setApprovalPrompt($approvalPrompt)
+ {
+ $this->config->setApprovalPrompt($approvalPrompt);
+ }
+
+ /**
+ * Set the login hint, email address or sub id.
+ * @param string $loginHint
+ */
+ public function setLoginHint($loginHint)
+ {
+ $this->config->setLoginHint($loginHint);
+ }
+
+ /**
+ * Set the application name, this is included in the User-Agent HTTP header.
+ * @param string $applicationName
+ */
+ public function setApplicationName($applicationName)
+ {
+ $this->config->setApplicationName($applicationName);
+ }
+
+ /**
+ * Set the OAuth 2.0 Client ID.
+ * @param string $clientId
+ */
+ public function setClientId($clientId)
+ {
+ $this->config->setClientId($clientId);
+ }
+
+ /**
+ * Set the OAuth 2.0 Client Secret.
+ * @param string $clientSecret
+ */
+ public function setClientSecret($clientSecret)
+ {
+ $this->config->setClientSecret($clientSecret);
+ }
+
+ /**
+ * Set the OAuth 2.0 Redirect URI.
+ * @param string $redirectUri
+ */
+ public function setRedirectUri($redirectUri)
+ {
+ $this->config->setRedirectUri($redirectUri);
+ }
+
+ /**
+ * If 'plus.login' is included in the list of requested scopes, you can use
+ * this method to define types of app activities that your app will write.
+ * You can find a list of available types here:
+ * @link https://developers.google.com/+/api/moment-types
+ *
+ * @param array $requestVisibleActions Array of app activity types
+ */
+ public function setRequestVisibleActions($requestVisibleActions)
+ {
+ if (is_array($requestVisibleActions)) {
+ $requestVisibleActions = join(" ", $requestVisibleActions);
+ }
+ $this->config->setRequestVisibleActions($requestVisibleActions);
+ }
+
+ /**
+ * Set the developer key to use, these are obtained through the API Console.
+ * @see http://code.google.com/apis/console-help/#generatingdevkeys
+ * @param string $developerKey
+ */
+ public function setDeveloperKey($developerKey)
+ {
+ $this->config->setDeveloperKey($developerKey);
+ }
+
+ /**
+ * Set the hd (hosted domain) parameter streamlines the login process for
+ * Google Apps hosted accounts. By including the domain of the user, you
+ * restrict sign-in to accounts at that domain.
+ * @param $hd string - the domain to use.
+ */
+ public function setHostedDomain($hd)
+ {
+ $this->config->setHostedDomain($hd);
+ }
+
+ /**
+ * Set the prompt hint. Valid values are none, consent and select_account.
+ * If no value is specified and the user has not previously authorized
+ * access, then the user is shown a consent screen.
+ * @param $prompt string
+ */
+ public function setPrompt($prompt)
+ {
+ $this->config->setPrompt($prompt);
+ }
+
+ /**
+ * openid.realm is a parameter from the OpenID 2.0 protocol, not from OAuth
+ * 2.0. It is used in OpenID 2.0 requests to signify the URL-space for which
+ * an authentication request is valid.
+ * @param $realm string - the URL-space to use.
+ */
+ public function setOpenidRealm($realm)
+ {
+ $this->config->setOpenidRealm($realm);
+ }
+
+ /**
+ * If this is provided with the value true, and the authorization request is
+ * granted, the authorization will include any previous authorizations
+ * granted to this user/application combination for other scopes.
+ * @param $include boolean - the URL-space to use.
+ */
+ public function setIncludeGrantedScopes($include)
+ {
+ $this->config->setIncludeGrantedScopes($include);
+ }
+
+ /**
+ * Fetches a fresh OAuth 2.0 access token with the given refresh token.
+ * @param string $refreshToken
+ * @return void
+ */
+ public function refreshToken($refreshToken)
+ {
+ return $this->getAuth()->refreshToken($refreshToken);
+ }
+
+ /**
+ * Revoke an OAuth2 access token or refresh token. This method will revoke the current access
+ * token, if a token isn't provided.
+ * @throws Google_Auth_Exception
+ * @param string|null $token The token (access token or a refresh token) that should be revoked.
+ * @return boolean Returns True if the revocation was successful, otherwise False.
+ */
+ public function revokeToken($token = null)
+ {
+ return $this->getAuth()->revokeToken($token);
+ }
+
+ /**
+ * Verify an id_token. This method will verify the current id_token, if one
+ * isn't provided.
+ * @throws Google_Auth_Exception
+ * @param string|null $token The token (id_token) that should be verified.
+ * @return Google_Auth_LoginTicket Returns an apiLoginTicket if the verification was
+ * successful.
+ */
+ public function verifyIdToken($token = null)
+ {
+ return $this->getAuth()->verifyIdToken($token);
+ }
+
+ /**
+ * Verify a JWT that was signed with your own certificates.
+ *
+ * @param $jwt the token
+ * @param $certs array of certificates
+ * @param $required_audience the expected consumer of the token
+ * @param [$issuer] the expected issues, defaults to Google
+ * @param [$max_expiry] the max lifetime of a token, defaults to MAX_TOKEN_LIFETIME_SECS
+ * @return token information if valid, false if not
+ */
+ public function verifySignedJwt($id_token, $cert_location, $audience, $issuer, $max_expiry = null)
+ {
+ $auth = new Google_Auth_OAuth2($this);
+ $certs = $auth->retrieveCertsFromLocation($cert_location);
+ return $auth->verifySignedJwtWithCerts($id_token, $certs, $audience, $issuer, $max_expiry);
+ }
+
+ /**
+ * @param Google_Auth_AssertionCredentials $creds
+ * @return void
+ */
+ public function setAssertionCredentials(Google_Auth_AssertionCredentials $creds)
+ {
+ $this->getAuth()->setAssertionCredentials($creds);
+ }
+
+ /**
+ * Set the scopes to be requested. Must be called before createAuthUrl().
+ * Will remove any previously configured scopes.
+ * @param array $scopes, ie: array('https://www.googleapis.com/auth/plus.login',
+ * 'https://www.googleapis.com/auth/moderator')
+ */
+ public function setScopes($scopes)
+ {
+ $this->requestedScopes = array();
+ $this->addScope($scopes);
+ }
+
+ /**
+ * This functions adds a scope to be requested as part of the OAuth2.0 flow.
+ * Will append any scopes not previously requested to the scope parameter.
+ * A single string will be treated as a scope to request. An array of strings
+ * will each be appended.
+ * @param $scope_or_scopes string|array e.g. "profile"
+ */
+ public function addScope($scope_or_scopes)
+ {
+ if (is_string($scope_or_scopes) && !in_array($scope_or_scopes, $this->requestedScopes)) {
+ $this->requestedScopes[] = $scope_or_scopes;
+ } else if (is_array($scope_or_scopes)) {
+ foreach ($scope_or_scopes as $scope) {
+ $this->addScope($scope);
+ }
+ }
+ }
+
+ /**
+ * Returns the list of scopes requested by the client
+ * @return array the list of scopes
+ *
+ */
+ public function getScopes()
+ {
+ return $this->requestedScopes;
+ }
+
+ /**
+ * Declare whether batch calls should be used. This may increase throughput
+ * by making multiple requests in one connection.
+ *
+ * @param boolean $useBatch True if the batch support should
+ * be enabled. Defaults to False.
+ */
+ public function setUseBatch($useBatch)
+ {
+ // This is actually an alias for setDefer.
+ $this->setDefer($useBatch);
+ }
+
+ /**
+ * Declare whether making API calls should make the call immediately, or
+ * return a request which can be called with ->execute();
+ *
+ * @param boolean $defer True if calls should not be executed right away.
+ */
+ public function setDefer($defer)
+ {
+ $this->deferExecution = $defer;
+ }
+
+ /**
+ * Helper method to execute deferred HTTP requests.
+ *
+ * @return object of the type of the expected class or array.
+ */
+ public function execute($request)
+ {
+ if ($request instanceof Google_Http_Request) {
+ $request->setUserAgent(
+ $this->getApplicationName()
+ . " " . self::USER_AGENT_SUFFIX
+ . $this->getLibraryVersion()
+ );
+ if (!$this->getClassConfig("Google_Http_Request", "disable_gzip")) {
+ $request->enableGzip();
+ }
+ $request->maybeMoveParametersToBody();
+ return Google_Http_REST::execute($this, $request);
+ } else if ($request instanceof Google_Http_Batch) {
+ return $request->execute();
+ } else {
+ throw new Google_Exception("Do not know how to execute this type of object.");
+ }
+ }
+
+ /**
+ * Whether or not to return raw requests
+ * @return boolean
+ */
+ public function shouldDefer()
+ {
+ return $this->deferExecution;
+ }
+
+ /**
+ * @return Google_Auth_Abstract Authentication implementation
+ */
+ public function getAuth()
+ {
+ if (!isset($this->auth)) {
+ $class = $this->config->getAuthClass();
+ $this->auth = new $class($this);
+ }
+ return $this->auth;
+ }
+
+ /**
+ * @return Google_IO_Abstract IO implementation
+ */
+ public function getIo()
+ {
+ if (!isset($this->io)) {
+ $class = $this->config->getIoClass();
+ $this->io = new $class($this);
+ }
+ return $this->io;
+ }
+
+ /**
+ * @return Google_Cache_Abstract Cache implementation
+ */
+ public function getCache()
+ {
+ if (!isset($this->cache)) {
+ $class = $this->config->getCacheClass();
+ $this->cache = new $class($this);
+ }
+ return $this->cache;
+ }
+
+ /**
+ * Retrieve custom configuration for a specific class.
+ * @param $class string|object - class or instance of class to retrieve
+ * @param $key string optional - key to retrieve
+ */
+ public function getClassConfig($class, $key = null)
+ {
+ if (!is_string($class)) {
+ $class = get_class($class);
+ }
+ return $this->config->getClassConfig($class, $key);
+ }
+
+ /**
+ * Set configuration specific to a given class.
+ * $config->setClassConfig('Google_Cache_File',
+ * array('directory' => '/tmp/cache'));
+ * @param $class The class name for the configuration
+ * @param $config string key or an array of configuration values
+ * @param $value optional - if $config is a key, the value
+ *
+ */
+ public function setClassConfig($class, $config, $value = null)
+ {
+ if (!is_string($class)) {
+ $class = get_class($class);
+ }
+ return $this->config->setClassConfig($class, $config, $value);
+
+ }
+
+ /**
+ * @return string the base URL to use for calls to the APIs
+ */
+ public function getBasePath()
+ {
+ return $this->config->getBasePath();
+ }
+
+ /**
+ * @return string the name of the application
+ */
+ public function getApplicationName()
+ {
+ return $this->config->getApplicationName();
+ }
+
+ /**
+ * Are we running in Google AppEngine?
+ * return bool
+ */
+ public function isAppEngine()
+ {
+ return (isset($_SERVER['SERVER_SOFTWARE']) &&
+ strpos($_SERVER['SERVER_SOFTWARE'], 'Google App Engine') !== false);
+ }
+}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Collection.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Collection.php
new file mode 100644
index 00000000000..6e7bf9b0f1e
--- /dev/null
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Collection.php
@@ -0,0 +1,96 @@
+<?php
+
+require_once "Google/Model.php";
+
+/**
+ * Extension to the regular Google_Model that automatically
+ * exposes the items array for iteration, so you can just
+ * iterate over the object rather than a reference inside.
+ */
+class Google_Collection extends Google_Model implements Iterator, Countable
+{
+ protected $collection_key = 'items';
+
+ public function rewind()
+ {
+ if (isset($this->modelData[$this->collection_key])
+ && is_array($this->modelData[$this->collection_key])) {
+ reset($this->modelData[$this->collection_key]);
+ }
+ }
+
+ public function current()
+ {
+ $this->coerceType($this->key());
+ if (is_array($this->modelData[$this->collection_key])) {
+ return current($this->modelData[$this->collection_key]);
+ }
+ }
+
+ public function key()
+ {
+ if (isset($this->modelData[$this->collection_key])
+ && is_array($this->modelData[$this->collection_key])) {
+ return key($this->modelData[$this->collection_key]);
+ }
+ }
+
+ public function next()
+ {
+ return next($this->modelData[$this->collection_key]);
+ }
+
+ public function valid()
+ {
+ $key = $this->key();
+ return $key !== null && $key !== false;
+ }
+
+ public function count()
+ {
+ return count($this->modelData[$this->collection_key]);
+ }
+
+ public function offsetExists ($offset)
+ {
+ if (!is_numeric($offset)) {
+ return parent::offsetExists($offset);
+ }
+ return isset($this->modelData[$this->collection_key][$offset]);
+ }
+
+ public function offsetGet($offset)
+ {
+ if (!is_numeric($offset)) {
+ return parent::offsetGet($offset);
+ }
+ $this->coerceType($offset);
+ return $this->modelData[$this->collection_key][$offset];
+ }
+
+ public function offsetSet($offset, $value)
+ {
+ if (!is_numeric($offset)) {
+ return parent::offsetSet($offset, $value);
+ }
+ $this->modelData[$this->collection_key][$offset] = $value;
+ }
+
+ public function offsetUnset($offset)
+ {
+ if (!is_numeric($offset)) {
+ return parent::offsetUnset($offset);
+ }
+ unset($this->modelData[$this->collection_key][$offset]);
+ }
+
+ private function coerceType($offset)
+ {
+ $typeKey = $this->keyType($this->collection_key);
+ if (isset($this->$typeKey) && !is_object($this->modelData[$this->collection_key][$offset])) {
+ $type = $this->$typeKey;
+ $this->modelData[$this->collection_key][$offset] =
+ new $type($this->modelData[$this->collection_key][$offset]);
+ }
+ }
+}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Config.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Config.php
new file mode 100644
index 00000000000..84083058fe5
--- /dev/null
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Config.php
@@ -0,0 +1,371 @@
+<?php
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * A class to contain the library configuration for the Google API client.
+ */
+class Google_Config
+{
+ const GZIP_DISABLED = true;
+ const GZIP_ENABLED = false;
+ const GZIP_UPLOADS_ENABLED = true;
+ const GZIP_UPLOADS_DISABLED = false;
+ const USE_AUTO_IO_SELECTION = "auto";
+ protected $configuration;
+
+ /**
+ * Create a new Google_Config. Can accept an ini file location with the
+ * local configuration. For example:
+ * application_name="My App"
+ *
+ * @param [$ini_file_location] - optional - The location of the ini file to load
+ */
+ public function __construct($ini_file_location = null)
+ {
+ $this->configuration = array(
+ // The application_name is included in the User-Agent HTTP header.
+ 'application_name' => '',
+
+ // Which Authentication, Storage and HTTP IO classes to use.
+ 'auth_class' => 'Google_Auth_OAuth2',
+ 'io_class' => self::USE_AUTO_IO_SELECTION,
+ 'cache_class' => 'Google_Cache_File',
+
+ // Don't change these unless you're working against a special development
+ // or testing environment.
+ 'base_path' => 'https://www.googleapis.com',
+
+ // Definition of class specific values, like file paths and so on.
+ 'classes' => array(
+ 'Google_IO_Abstract' => array(
+ 'request_timeout_seconds' => 100,
+ ),
+ 'Google_Http_Request' => array(
+ // Disable the use of gzip on calls if set to true. Defaults to false.
+ 'disable_gzip' => self::GZIP_ENABLED,
+
+ // We default gzip to disabled on uploads even if gzip is otherwise
+ // enabled, due to some issues seen with small packet sizes for uploads.
+ // Please test with this option before enabling gzip for uploads in
+ // a production environment.
+ 'enable_gzip_for_uploads' => self::GZIP_UPLOADS_DISABLED,
+ ),
+ // If you want to pass in OAuth 2.0 settings, they will need to be
+ // structured like this.
+ 'Google_Auth_OAuth2' => array(
+ // Keys for OAuth 2.0 access, see the API console at
+ // https://developers.google.com/console
+ 'client_id' => '',
+ 'client_secret' => '',
+ 'redirect_uri' => '',
+
+ // Simple API access key, also from the API console. Ensure you get
+ // a Server key, and not a Browser key.
+ 'developer_key' => '',
+
+ // Other parameters.
+ 'hd' => '',
+ 'prompt' => '',
+ 'openid.realm' => '',
+ 'include_granted_scopes' => '',
+ 'login_hint' => '',
+ 'request_visible_actions' => '',
+ 'access_type' => 'online',
+ 'approval_prompt' => 'auto',
+ 'federated_signon_certs_url' =>
+ 'https://www.googleapis.com/oauth2/v1/certs',
+ ),
+ // Set a default directory for the file cache.
+ 'Google_Cache_File' => array(
+ 'directory' => sys_get_temp_dir() . '/Google_Client'
+ )
+ ),
+ );
+ if ($ini_file_location) {
+ $ini = parse_ini_file($ini_file_location, true);
+ if (is_array($ini) && count($ini)) {
+ $this->configuration = array_merge($this->configuration, $ini);
+ }
+ }
+ }
+
+ /**
+ * Set configuration specific to a given class.
+ * $config->setClassConfig('Google_Cache_File',
+ * array('directory' => '/tmp/cache'));
+ * @param $class The class name for the configuration
+ * @param $config string key or an array of configuration values
+ * @param $value optional - if $config is a key, the value
+ */
+ public function setClassConfig($class, $config, $value = null)
+ {
+ if (!is_array($config)) {
+ if (!isset($this->configuration['classes'][$class])) {
+ $this->configuration['classes'][$class] = array();
+ }
+ $this->configuration['classes'][$class][$config] = $value;
+ } else {
+ $this->configuration['classes'][$class] = $config;
+ }
+ }
+
+ public function getClassConfig($class, $key = null)
+ {
+ if (!isset($this->configuration['classes'][$class])) {
+ return null;
+ }
+ if ($key === null) {
+ return $this->configuration['classes'][$class];
+ } else {
+ return $this->configuration['classes'][$class][$key];
+ }
+ }
+
+ /**
+ * Return the configured cache class.
+ * @return string
+ */
+ public function getCacheClass()
+ {
+ return $this->configuration['cache_class'];
+ }
+
+ /**
+ * Return the configured Auth class.
+ * @return string
+ */
+ public function getAuthClass()
+ {
+ return $this->configuration['auth_class'];
+ }
+
+ /**
+ * Set the auth class.
+ *
+ * @param $class the class name to set
+ */
+ public function setAuthClass($class)
+ {
+ $prev = $this->configuration['auth_class'];
+ if (!isset($this->configuration['classes'][$class]) &&
+ isset($this->configuration['classes'][$prev])) {
+ $this->configuration['classes'][$class] =
+ $this->configuration['classes'][$prev];
+ }
+ $this->configuration['auth_class'] = $class;
+ }
+
+ /**
+ * Set the IO class.
+ *
+ * @param $class the class name to set
+ */
+ public function setIoClass($class)
+ {
+ $prev = $this->configuration['io_class'];
+ if (!isset($this->configuration['classes'][$class]) &&
+ isset($this->configuration['classes'][$prev])) {
+ $this->configuration['classes'][$class] =
+ $this->configuration['classes'][$prev];
+ }
+ $this->configuration['io_class'] = $class;
+ }
+
+ /**
+ * Set the cache class.
+ *
+ * @param $class the class name to set
+ */
+ public function setCacheClass($class)
+ {
+ $prev = $this->configuration['cache_class'];
+ if (!isset($this->configuration['classes'][$class]) &&
+ isset($this->configuration['classes'][$prev])) {
+ $this->configuration['classes'][$class] =
+ $this->configuration['classes'][$prev];
+ }
+ $this->configuration['cache_class'] = $class;
+ }
+
+ /**
+ * Return the configured IO class.
+ * @return string
+ */
+ public function getIoClass()
+ {
+ return $this->configuration['io_class'];
+ }
+
+ /**
+ * Set the application name, this is included in the User-Agent HTTP header.
+ * @param string $name
+ */
+ public function setApplicationName($name)
+ {
+ $this->configuration['application_name'] = $name;
+ }
+
+ /**
+ * @return string the name of the application
+ */
+ public function getApplicationName()
+ {
+ return $this->configuration['application_name'];
+ }
+
+ /**
+ * Set the client ID for the auth class.
+ * @param $key string - the API console client ID
+ */
+ public function setClientId($clientId)
+ {
+ $this->setAuthConfig('client_id', $clientId);
+ }
+
+ /**
+ * Set the client secret for the auth class.
+ * @param $key string - the API console client secret
+ */
+ public function setClientSecret($secret)
+ {
+ $this->setAuthConfig('client_secret', $secret);
+ }
+
+ /**
+ * Set the redirect uri for the auth class. Note that if using the
+ * Javascript based sign in flow, this should be the string 'postmessage'.
+ * @param $key string - the URI that users should be redirected to
+ */
+ public function setRedirectUri($uri)
+ {
+ $this->setAuthConfig('redirect_uri', $uri);
+ }
+
+ /**
+ * Set the app activities for the auth class.
+ * @param $rva string a space separated list of app activity types
+ */
+ public function setRequestVisibleActions($rva)
+ {
+ $this->setAuthConfig('request_visible_actions', $rva);
+ }
+
+ /**
+ * Set the the access type requested (offline or online.)
+ * @param $access string - the access type
+ */
+ public function setAccessType($access)
+ {
+ $this->setAuthConfig('access_type', $access);
+ }
+
+ /**
+ * Set when to show the approval prompt (auto or force)
+ * @param $approval string - the approval request
+ */
+ public function setApprovalPrompt($approval)
+ {
+ $this->setAuthConfig('approval_prompt', $approval);
+ }
+
+ /**
+ * Set the login hint (email address or sub identifier)
+ * @param $hint string
+ */
+ public function setLoginHint($hint)
+ {
+ $this->setAuthConfig('login_hint', $hint);
+ }
+
+ /**
+ * Set the developer key for the auth class. Note that this is separate value
+ * from the client ID - if it looks like a URL, its a client ID!
+ * @param $key string - the API console developer key
+ */
+ public function setDeveloperKey($key)
+ {
+ $this->setAuthConfig('developer_key', $key);
+ }
+
+ /**
+ * Set the hd (hosted domain) parameter streamlines the login process for
+ * Google Apps hosted accounts. By including the domain of the user, you
+ * restrict sign-in to accounts at that domain.
+ * @param $hd string - the domain to use.
+ */
+ public function setHostedDomain($hd)
+ {
+ $this->setAuthConfig('hd', $hd);
+ }
+
+ /**
+ * Set the prompt hint. Valid values are none, consent and select_account.
+ * If no value is specified and the user has not previously authorized
+ * access, then the user is shown a consent screen.
+ * @param $prompt string
+ */
+ public function setPrompt($prompt)
+ {
+ $this->setAuthConfig('prompt', $prompt);
+ }
+
+ /**
+ * openid.realm is a parameter from the OpenID 2.0 protocol, not from OAuth
+ * 2.0. It is used in OpenID 2.0 requests to signify the URL-space for which
+ * an authentication request is valid.
+ * @param $realm string - the URL-space to use.
+ */
+ public function setOpenidRealm($realm)
+ {
+ $this->setAuthConfig('openid.realm', $realm);
+ }
+
+ /**
+ * If this is provided with the value true, and the authorization request is
+ * granted, the authorization will include any previous authorizations
+ * granted to this user/application combination for other scopes.
+ * @param $include boolean - the URL-space to use.
+ */
+ public function setIncludeGrantedScopes($include)
+ {
+ $this->setAuthConfig(
+ 'include_granted_scopes',
+ $include ? "true" : "false"
+ );
+ }
+
+ /**
+ * @return string the base URL to use for API calls
+ */
+ public function getBasePath()
+ {
+ return $this->configuration['base_path'];
+ }
+
+ /**
+ * Set the auth configuration for the current auth class.
+ * @param $key - the key to set
+ * @param $value - the parameter value
+ */
+ private function setAuthConfig($key, $value)
+ {
+ if (!isset($this->configuration['classes'][$this->getAuthClass()])) {
+ $this->configuration['classes'][$this->getAuthClass()] = array();
+ }
+ $this->configuration['classes'][$this->getAuthClass()][$key] = $value;
+ }
+}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/service/Google_Service.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Exception.php
index 1f4731fb2f4..af80269718a 100644
--- a/apps/files_external/3rdparty/google-api-php-client/src/service/Google_Service.php
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Exception.php
@@ -1,6 +1,6 @@
<?php
/*
- * Copyright 2010 Google Inc.
+ * Copyright 2013 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,8 +15,6 @@
* limitations under the License.
*/
-class Google_Service {
- public $version;
- public $servicePath;
- public $resource;
+class Google_Exception extends Exception
+{
}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/service/Google_BatchRequest.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Http/Batch.php
index 3916b223a7e..d851da50499 100644
--- a/apps/files_external/3rdparty/google-api-php-client/src/service/Google_BatchRequest.php
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Http/Batch.php
@@ -15,22 +15,39 @@
* limitations under the License.
*/
+require_once 'Google/Client.php';
+require_once 'Google/Http/Request.php';
+require_once 'Google/Http/REST.php';
+
/**
* @author Chirag Shah <chirags@google.com>
*/
-class Google_BatchRequest {
+class Google_Http_Batch
+{
/** @var string Multipart Boundary. */
private $boundary;
/** @var array service requests to be executed. */
private $requests = array();
- public function __construct($boundary = false) {
+ /** @var Google_Client */
+ private $client;
+
+ private $expected_classes = array();
+
+ private $base_path;
+
+ public function __construct(Google_Client $client, $boundary = false)
+ {
+ $this->client = $client;
+ $this->base_path = $this->client->getBasePath();
+ $this->expected_classes = array();
$boundary = (false == $boundary) ? mt_rand() : $boundary;
$this->boundary = str_replace('"', '', $boundary);
}
- public function add(Google_HttpRequest $request, $key = false) {
+ public function add(Google_Http_Request $request, $key = false)
+ {
if (false == $key) {
$key = mt_rand();
}
@@ -38,36 +55,38 @@ class Google_BatchRequest {
$this->requests[$key] = $request;
}
- public function execute() {
+ public function execute()
+ {
$body = '';
- /** @var Google_HttpRequest $req */
- foreach($this->requests as $key => $req) {
+ /** @var Google_Http_Request $req */
+ foreach ($this->requests as $key => $req) {
$body .= "--{$this->boundary}\n";
$body .= $req->toBatchString($key) . "\n";
+ $this->expected_classes["response-" . $key] = $req->getExpectedClass();
}
$body = rtrim($body);
$body .= "\n--{$this->boundary}--";
- global $apiConfig;
- $url = $apiConfig['basePath'] . '/batch';
- $httpRequest = new Google_HttpRequest($url, 'POST');
- $httpRequest->setRequestHeaders(array(
- 'Content-Type' => 'multipart/mixed; boundary=' . $this->boundary));
+ $url = $this->base_path . '/batch';
+ $httpRequest = new Google_Http_Request($url, 'POST');
+ $httpRequest->setRequestHeaders(
+ array('Content-Type' => 'multipart/mixed; boundary=' . $this->boundary)
+ );
$httpRequest->setPostBody($body);
- $response = Google_Client::$io->makeRequest($httpRequest);
+ $response = $this->client->getIo()->makeRequest($httpRequest);
- $response = $this->parseResponse($response);
- return $response;
+ return $this->parseResponse($response);
}
- public function parseResponse(Google_HttpRequest $response) {
+ public function parseResponse(Google_Http_Request $response)
+ {
$contentType = $response->getResponseHeader('content-type');
$contentType = explode(';', $contentType);
$boundary = false;
- foreach($contentType as $part) {
+ foreach ($contentType as $part) {
$part = (explode('=', $part, 2));
if (isset($part[0]) && 'boundary' == trim($part[0])) {
$boundary = $part[1];
@@ -80,25 +99,39 @@ class Google_BatchRequest {
$parts = explode("--$boundary", $body);
$responses = array();
- foreach($parts as $part) {
+ foreach ($parts as $part) {
$part = trim($part);
if (!empty($part)) {
list($metaHeaders, $part) = explode("\r\n\r\n", $part, 2);
- $metaHeaders = Google_CurlIO::parseResponseHeaders($metaHeaders);
+ $metaHeaders = $this->client->getIo()->getHttpResponseHeaders($metaHeaders);
$status = substr($part, 0, strpos($part, "\n"));
$status = explode(" ", $status);
$status = $status[1];
- list($partHeaders, $partBody) = Google_CurlIO::parseHttpResponse($part, false);
- $response = new Google_HttpRequest("");
+ list($partHeaders, $partBody) = $this->client->getIo()->ParseHttpResponse($part, false);
+ $response = new Google_Http_Request("");
$response->setResponseHttpCode($status);
$response->setResponseHeaders($partHeaders);
$response->setResponseBody($partBody);
- $response = Google_REST::decodeHttpResponse($response);
// Need content id.
- $responses[$metaHeaders['content-id']] = $response;
+ $key = $metaHeaders['content-id'];
+
+ if (isset($this->expected_classes[$key]) &&
+ strlen($this->expected_classes[$key]) > 0) {
+ $class = $this->expected_classes[$key];
+ $response->setExpectedClass($class);
+ }
+
+ try {
+ $response = Google_Http_REST::decodeHttpResponse($response);
+ $responses[$key] = $response;
+ } catch (Google_Service_Exception $e) {
+ // Store the exception as the response, so succesful responses
+ // can be processed.
+ $responses[$key] = $e;
+ }
}
}
@@ -107,4 +140,4 @@ class Google_BatchRequest {
return null;
}
-} \ No newline at end of file
+}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/io/Google_CacheParser.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Http/CacheParser.php
index 7f5accfefe9..83f1c8d2f42 100644
--- a/apps/files_external/3rdparty/google-api-php-client/src/io/Google_CacheParser.php
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Http/CacheParser.php
@@ -14,26 +14,29 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
+require_once 'Google/Http/Request.php';
+
/**
* Implement the caching directives specified in rfc2616. This
* implementation is guided by the guidance offered in rfc2616-sec13.
* @author Chirag Shah <chirags@google.com>
*/
-class Google_CacheParser {
+class Google_Http_CacheParser
+{
public static $CACHEABLE_HTTP_METHODS = array('GET', 'HEAD');
public static $CACHEABLE_STATUS_CODES = array('200', '203', '300', '301');
- private function __construct() {}
-
/**
* Check if an HTTP request can be cached by a private local cache.
*
* @static
- * @param Google_HttpRequest $resp
+ * @param Google_Http_Request $resp
* @return bool True if the request is cacheable.
* False if the request is uncacheable.
*/
- public static function isRequestCacheable (Google_HttpRequest $resp) {
+ public static function isRequestCacheable(Google_Http_Request $resp)
+ {
$method = $resp->getRequestMethod();
if (! in_array($method, self::$CACHEABLE_HTTP_METHODS)) {
return false;
@@ -54,11 +57,12 @@ class Google_CacheParser {
* Check if an HTTP response can be cached by a private local cache.
*
* @static
- * @param Google_HttpRequest $resp
+ * @param Google_Http_Request $resp
* @return bool True if the response is cacheable.
* False if the response is un-cacheable.
*/
- public static function isResponseCacheable (Google_HttpRequest $resp) {
+ public static function isResponseCacheable(Google_Http_Request $resp)
+ {
// First, check if the HTTP request was cacheable before inspecting the
// HTTP response.
if (false == self::isRequestCacheable($resp)) {
@@ -105,15 +109,17 @@ class Google_CacheParser {
/**
* @static
- * @param Google_HttpRequest $resp
+ * @param Google_Http_Request $resp
* @return bool True if the HTTP response is considered to be expired.
* False if it is considered to be fresh.
*/
- public static function isExpired(Google_HttpRequest $resp) {
+ public static function isExpired(Google_Http_Request $resp)
+ {
// HTTP/1.1 clients and caches MUST treat other invalid date formats,
// especially including the value “0”, as in the past.
$parsedExpires = false;
$responseHeaders = $resp->getResponseHeaders();
+
if (isset($responseHeaders['expires'])) {
$rawExpires = $responseHeaders['expires'];
// Check for a malformed expires header first.
@@ -139,8 +145,12 @@ class Google_CacheParser {
$parsedDate = strtotime($rawDate);
if (empty($rawDate) || false == $parsedDate) {
- $parsedDate = time();
+ // We can't default this to now, as that means future cache reads
+ // will always pass with the logic below, so we will require a
+ // date be injected if not supplied.
+ throw new Google_Exception("All cacheable requests must have creation dates.");
}
+
if (false == $freshnessLifetime && isset($responseHeaders['expires'])) {
$freshnessLifetime = $parsedExpires - $parsedDate;
}
@@ -161,13 +171,14 @@ class Google_CacheParser {
/**
* Determine if a cache entry should be revalidated with by the origin.
*
- * @param Google_HttpRequest $response
+ * @param Google_Http_Request $response
* @return bool True if the entry is expired, else return false.
*/
- public static function mustRevalidate(Google_HttpRequest $response) {
+ public static function mustRevalidate(Google_Http_Request $response)
+ {
// [13.3] When a cache has a stale entry that it would like to use as a
// response to a client's request, it first has to check with the origin
// server to see if its cached entry is still usable.
return self::isExpired($response);
}
-} \ No newline at end of file
+}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Http/MediaFileUpload.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Http/MediaFileUpload.php
new file mode 100644
index 00000000000..8005db4bb48
--- /dev/null
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Http/MediaFileUpload.php
@@ -0,0 +1,301 @@
+<?php
+/**
+ * Copyright 2012 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+require_once 'Google/Client.php';
+require_once 'Google/Exception.php';
+require_once 'Google/Http/Request.php';
+require_once 'Google/Http/REST.php';
+require_once 'Google/Utils.php';
+
+/**
+ * @author Chirag Shah <chirags@google.com>
+ *
+ */
+class Google_Http_MediaFileUpload
+{
+ const UPLOAD_MEDIA_TYPE = 'media';
+ const UPLOAD_MULTIPART_TYPE = 'multipart';
+ const UPLOAD_RESUMABLE_TYPE = 'resumable';
+
+ /** @var string $mimeType */
+ private $mimeType;
+
+ /** @var string $data */
+ private $data;
+
+ /** @var bool $resumable */
+ private $resumable;
+
+ /** @var int $chunkSize */
+ private $chunkSize;
+
+ /** @var int $size */
+ private $size;
+
+ /** @var string $resumeUri */
+ private $resumeUri;
+
+ /** @var int $progress */
+ private $progress;
+
+ /** @var Google_Client */
+ private $client;
+
+ /** @var Google_Http_Request */
+ private $request;
+
+ /** @var string */
+ private $boundary;
+
+ /**
+ * Result code from last HTTP call
+ * @var int
+ */
+ private $httpResultCode;
+
+ /**
+ * @param $mimeType string
+ * @param $data string The bytes you want to upload.
+ * @param $resumable bool
+ * @param bool $chunkSize File will be uploaded in chunks of this many bytes.
+ * only used if resumable=True
+ */
+ public function __construct(
+ Google_Client $client,
+ Google_Http_Request $request,
+ $mimeType,
+ $data,
+ $resumable = false,
+ $chunkSize = false,
+ $boundary = false
+ ) {
+ $this->client = $client;
+ $this->request = $request;
+ $this->mimeType = $mimeType;
+ $this->data = $data;
+ $this->size = strlen($this->data);
+ $this->resumable = $resumable;
+ if (!$chunkSize) {
+ $chunkSize = 256 * 1024;
+ }
+ $this->chunkSize = $chunkSize;
+ $this->progress = 0;
+ $this->boundary = $boundary;
+
+ // Process Media Request
+ $this->process();
+ }
+
+ /**
+ * Set the size of the file that is being uploaded.
+ * @param $size - int file size in bytes
+ */
+ public function setFileSize($size)
+ {
+ $this->size = $size;
+ }
+
+ /**
+ * Return the progress on the upload
+ * @return int progress in bytes uploaded.
+ */
+ public function getProgress()
+ {
+ return $this->progress;
+ }
+
+ /**
+ * Return the HTTP result code from the last call made.
+ * @return int code
+ */
+ public function getHttpResultCode()
+ {
+ return $this->httpResultCode;
+ }
+
+ /**
+ * Send the next part of the file to upload.
+ * @param [$chunk] the next set of bytes to send. If false will used $data passed
+ * at construct time.
+ */
+ public function nextChunk($chunk = false)
+ {
+ if (false == $this->resumeUri) {
+ $this->resumeUri = $this->getResumeUri();
+ }
+
+ if (false == $chunk) {
+ $chunk = substr($this->data, $this->progress, $this->chunkSize);
+ }
+
+ $lastBytePos = $this->progress + strlen($chunk) - 1;
+ $headers = array(
+ 'content-range' => "bytes $this->progress-$lastBytePos/$this->size",
+ 'content-type' => $this->request->getRequestHeader('content-type'),
+ 'content-length' => $this->chunkSize,
+ 'expect' => '',
+ );
+
+ $httpRequest = new Google_Http_Request(
+ $this->resumeUri,
+ 'PUT',
+ $headers,
+ $chunk
+ );
+
+ if ($this->client->getClassConfig("Google_Http_Request", "enable_gzip_for_uploads")) {
+ $httpRequest->enableGzip();
+ } else {
+ $httpRequest->disableGzip();
+ }
+
+ $response = $this->client->getIo()->makeRequest($httpRequest);
+ $response->setExpectedClass($this->request->getExpectedClass());
+ $code = $response->getResponseHttpCode();
+ $this->httpResultCode = $code;
+
+ if (308 == $code) {
+ // Track the amount uploaded.
+ $range = explode('-', $response->getResponseHeader('range'));
+ $this->progress = $range[1] + 1;
+
+ // Allow for changing upload URLs.
+ $location = $response->getResponseHeader('location');
+ if ($location) {
+ $this->resumeUri = $location;
+ }
+
+ // No problems, but upload not complete.
+ return false;
+ } else {
+ return Google_Http_REST::decodeHttpResponse($response);
+ }
+ }
+
+ /**
+ * @param $meta
+ * @param $params
+ * @return array|bool
+ * @visible for testing
+ */
+ private function process()
+ {
+ $postBody = false;
+ $contentType = false;
+
+ $meta = $this->request->getPostBody();
+ $meta = is_string($meta) ? json_decode($meta, true) : $meta;
+
+ $uploadType = $this->getUploadType($meta);
+ $this->request->setQueryParam('uploadType', $uploadType);
+ $this->transformToUploadUrl();
+ $mimeType = $this->mimeType ?
+ $this->mimeType :
+ $this->request->getRequestHeader('content-type');
+
+ if (self::UPLOAD_RESUMABLE_TYPE == $uploadType) {
+ $contentType = $mimeType;
+ $postBody = is_string($meta) ? $meta : json_encode($meta);
+ } else if (self::UPLOAD_MEDIA_TYPE == $uploadType) {
+ $contentType = $mimeType;
+ $postBody = $this->data;
+ } else if (self::UPLOAD_MULTIPART_TYPE == $uploadType) {
+ // This is a multipart/related upload.
+ $boundary = $this->boundary ? $this->boundary : mt_rand();
+ $boundary = str_replace('"', '', $boundary);
+ $contentType = 'multipart/related; boundary=' . $boundary;
+ $related = "--$boundary\r\n";
+ $related .= "Content-Type: application/json; charset=UTF-8\r\n";
+ $related .= "\r\n" . json_encode($meta) . "\r\n";
+ $related .= "--$boundary\r\n";
+ $related .= "Content-Type: $mimeType\r\n";
+ $related .= "Content-Transfer-Encoding: base64\r\n";
+ $related .= "\r\n" . base64_encode($this->data) . "\r\n";
+ $related .= "--$boundary--";
+ $postBody = $related;
+ }
+
+ $this->request->setPostBody($postBody);
+
+ if (isset($contentType) && $contentType) {
+ $contentTypeHeader['content-type'] = $contentType;
+ $this->request->setRequestHeaders($contentTypeHeader);
+ }
+ }
+
+ private function transformToUploadUrl()
+ {
+ $base = $this->request->getBaseComponent();
+ $this->request->setBaseComponent($base . '/upload');
+ }
+
+ /**
+ * Valid upload types:
+ * - resumable (UPLOAD_RESUMABLE_TYPE)
+ * - media (UPLOAD_MEDIA_TYPE)
+ * - multipart (UPLOAD_MULTIPART_TYPE)
+ * @param $meta
+ * @return string
+ * @visible for testing
+ */
+ public function getUploadType($meta)
+ {
+ if ($this->resumable) {
+ return self::UPLOAD_RESUMABLE_TYPE;
+ }
+
+ if (false == $meta && $this->data) {
+ return self::UPLOAD_MEDIA_TYPE;
+ }
+
+ return self::UPLOAD_MULTIPART_TYPE;
+ }
+
+ private function getResumeUri()
+ {
+ $result = null;
+ $body = $this->request->getPostBody();
+ if ($body) {
+ $headers = array(
+ 'content-type' => 'application/json; charset=UTF-8',
+ 'content-length' => Google_Utils::getStrLen($body),
+ 'x-upload-content-type' => $this->mimeType,
+ 'x-upload-content-length' => $this->size,
+ 'expect' => '',
+ );
+ $this->request->setRequestHeaders($headers);
+ }
+
+ $response = $this->client->getIo()->makeRequest($this->request);
+ $location = $response->getResponseHeader('location');
+ $code = $response->getResponseHttpCode();
+
+ if (200 == $code && true == $location) {
+ return $location;
+ }
+ $message = $code;
+ $body = @json_decode($response->getResponseBody());
+ if (!empty( $body->error->errors ) ) {
+ $message .= ': ';
+ foreach ($body->error->errors as $error) {
+ $message .= "{$error->domain}, {$error->message};";
+ }
+ $message = rtrim($message, ';');
+ }
+ throw new Google_Exception("Failed to start the resumable upload (HTTP {$message})");
+ }
+}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/io/Google_REST.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Http/REST.php
index d0f3b3d564c..3c318e44ceb 100644
--- a/apps/files_external/3rdparty/google-api-php-client/src/io/Google_REST.php
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Http/REST.php
@@ -15,47 +15,54 @@
* limitations under the License.
*/
+require_once 'Google/Client.php';
+require_once 'Google/Http/Request.php';
+require_once 'Google/Service/Exception.php';
+require_once 'Google/Utils/URITemplate.php';
+
/**
* This class implements the RESTful transport of apiServiceRequest()'s
*
* @author Chris Chabot <chabotc@google.com>
* @author Chirag Shah <chirags@google.com>
*/
-class Google_REST {
+class Google_Http_REST
+{
/**
- * Executes a apiServiceRequest using a RESTful call by transforming it into
- * an apiHttpRequest, and executed via apiIO::authenticatedRequest().
+ * Executes a Google_Http_Request
*
- * @param Google_HttpRequest $req
+ * @param Google_Client $client
+ * @param Google_Http_Request $req
* @return array decoded result
- * @throws Google_ServiceException on server side error (ie: not authenticated,
+ * @throws Google_Service_Exception on server side error (ie: not authenticated,
* invalid or malformed post body, invalid url)
*/
- static public function execute(Google_HttpRequest $req) {
- $httpRequest = Google_Client::$io->makeRequest($req);
- $decodedResponse = self::decodeHttpResponse($httpRequest);
- $ret = isset($decodedResponse['data'])
- ? $decodedResponse['data'] : $decodedResponse;
- return $ret;
+ public static function execute(Google_Client $client, Google_Http_Request $req)
+ {
+ $httpRequest = $client->getIo()->makeRequest($req);
+ $httpRequest->setExpectedClass($req->getExpectedClass());
+ return self::decodeHttpResponse($httpRequest);
}
-
/**
* Decode an HTTP Response.
* @static
- * @throws Google_ServiceException
- * @param Google_HttpRequest $response The http response to be decoded.
+ * @throws Google_Service_Exception
+ * @param Google_Http_Request $response The http response to be decoded.
* @return mixed|null
*/
- public static function decodeHttpResponse($response) {
+ public static function decodeHttpResponse($response)
+ {
$code = $response->getResponseHttpCode();
$body = $response->getResponseBody();
$decoded = null;
-
+
if ((intVal($code)) >= 300) {
$decoded = json_decode($body, true);
$err = 'Error calling ' . $response->getRequestMethod() . ' ' . $response->getUrl();
- if ($decoded != null && isset($decoded['error']['message']) && isset($decoded['error']['code'])) {
+ if (isset($decoded['error']) &&
+ isset($decoded['error']['message']) &&
+ isset($decoded['error']['code'])) {
// if we're getting a json encoded error definition, use that instead of the raw response
// body for improved readability
$err .= ": ({$decoded['error']['code']}) {$decoded['error']['message']}";
@@ -63,14 +70,25 @@ class Google_REST {
$err .= ": ($code) $body";
}
- throw new Google_ServiceException($err, $code, null, $decoded['error']['errors']);
+ $errors = null;
+ // Specific check for APIs which don't return error details, such as Blogger.
+ if (isset($decoded['error']) && isset($decoded['error']['errors'])) {
+ $errors = $decoded['error']['errors'];
+ }
+
+ throw new Google_Service_Exception($err, $code, null, $errors);
}
-
+
// Only attempt to decode the response, if the response code wasn't (204) 'no content'
if ($code != '204') {
$decoded = json_decode($body, true);
if ($decoded === null || $decoded === "") {
- throw new Google_ServiceException("Invalid json in service response: $body");
+ throw new Google_Service_Exception("Invalid json in service response: $body");
+ }
+
+ if ($response->getExpectedClass()) {
+ $class = $response->getExpectedClass();
+ $decoded = new $class($decoded);
}
}
return $decoded;
@@ -85,22 +103,18 @@ class Google_REST {
* @param array $params
* @return string $requestUrl
*/
- static function createRequestUri($servicePath, $restPath, $params) {
+ public static function createRequestUri($servicePath, $restPath, $params)
+ {
$requestUrl = $servicePath . $restPath;
$uriTemplateVars = array();
$queryVars = array();
foreach ($params as $paramName => $paramSpec) {
- // Discovery v1.0 puts the canonical location under the 'location' field.
- if (! isset($paramSpec['location'])) {
- $paramSpec['location'] = $paramSpec['restParameterType'];
- }
-
if ($paramSpec['type'] == 'boolean') {
$paramSpec['value'] = ($paramSpec['value']) ? 'true' : 'false';
}
if ($paramSpec['location'] == 'path') {
$uriTemplateVars[$paramName] = $paramSpec['value'];
- } else {
+ } else if ($paramSpec['location'] == 'query') {
if (isset($paramSpec['repeated']) && is_array($paramSpec['value'])) {
foreach ($paramSpec['value'] as $value) {
$queryVars[] = $paramName . '=' . rawurlencode($value);
@@ -112,12 +126,9 @@ class Google_REST {
}
if (count($uriTemplateVars)) {
- $uriTemplateParser = new URI_Template_Parser($requestUrl);
- $requestUrl = $uriTemplateParser->expand($uriTemplateVars);
+ $uriTemplateParser = new Google_Utils_URITemplate();
+ $requestUrl = $uriTemplateParser->parse($requestUrl, $uriTemplateVars);
}
- //FIXME work around for the the uri template lib which url encodes
- // the @'s & confuses our servers.
- $requestUrl = str_replace('%40', '@', $requestUrl);
if (count($queryVars)) {
$requestUrl .= '?' . implode($queryVars, '&');
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Http/Request.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Http/Request.php
new file mode 100644
index 00000000000..8643694da89
--- /dev/null
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Http/Request.php
@@ -0,0 +1,476 @@
+<?php
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+require_once 'Google/Utils.php';
+
+/**
+ * HTTP Request to be executed by IO classes. Upon execution, the
+ * responseHttpCode, responseHeaders and responseBody will be filled in.
+ *
+ * @author Chris Chabot <chabotc@google.com>
+ * @author Chirag Shah <chirags@google.com>
+ *
+ */
+class Google_Http_Request
+{
+ const GZIP_UA = " (gzip)";
+
+ private $batchHeaders = array(
+ 'Content-Type' => 'application/http',
+ 'Content-Transfer-Encoding' => 'binary',
+ 'MIME-Version' => '1.0',
+ );
+
+ protected $queryParams;
+ protected $requestMethod;
+ protected $requestHeaders;
+ protected $baseComponent = null;
+ protected $path;
+ protected $postBody;
+ protected $userAgent;
+ protected $canGzip = null;
+
+ protected $responseHttpCode;
+ protected $responseHeaders;
+ protected $responseBody;
+
+ protected $expectedClass;
+
+ public $accessKey;
+
+ public function __construct(
+ $url,
+ $method = 'GET',
+ $headers = array(),
+ $postBody = null
+ ) {
+ $this->setUrl($url);
+ $this->setRequestMethod($method);
+ $this->setRequestHeaders($headers);
+ $this->setPostBody($postBody);
+ }
+
+ /**
+ * Misc function that returns the base url component of the $url
+ * used by the OAuth signing class to calculate the base string
+ * @return string The base url component of the $url.
+ */
+ public function getBaseComponent()
+ {
+ return $this->baseComponent;
+ }
+
+ /**
+ * Set the base URL that path and query parameters will be added to.
+ * @param $baseComponent string
+ */
+ public function setBaseComponent($baseComponent)
+ {
+ $this->baseComponent = $baseComponent;
+ }
+
+ /**
+ * Enable support for gzipped responses with this request.
+ */
+ public function enableGzip()
+ {
+ $this->setRequestHeaders(array("Accept-Encoding" => "gzip"));
+ $this->canGzip = true;
+ $this->setUserAgent($this->userAgent);
+ }
+
+ /**
+ * Disable support for gzip responses with this request.
+ */
+ public function disableGzip()
+ {
+ if (
+ isset($this->requestHeaders['accept-encoding']) &&
+ $this->requestHeaders['accept-encoding'] == "gzip"
+ ) {
+ unset($this->requestHeaders['accept-encoding']);
+ }
+ $this->canGzip = false;
+ $this->userAgent = str_replace(self::GZIP_UA, "", $this->userAgent);
+ }
+
+ /**
+ * Can this request accept a gzip response?
+ * @return bool
+ */
+ public function canGzip()
+ {
+ return $this->canGzip;
+ }
+
+ /**
+ * Misc function that returns an array of the query parameters of the current
+ * url used by the OAuth signing class to calculate the signature
+ * @return array Query parameters in the query string.
+ */
+ public function getQueryParams()
+ {
+ return $this->queryParams;
+ }
+
+ /**
+ * Set a new query parameter.
+ * @param $key - string to set, does not need to be URL encoded
+ * @param $value - string to set, does not need to be URL encoded
+ */
+ public function setQueryParam($key, $value)
+ {
+ $this->queryParams[$key] = $value;
+ }
+
+ /**
+ * @return string HTTP Response Code.
+ */
+ public function getResponseHttpCode()
+ {
+ return (int) $this->responseHttpCode;
+ }
+
+ /**
+ * @param int $responseHttpCode HTTP Response Code.
+ */
+ public function setResponseHttpCode($responseHttpCode)
+ {
+ $this->responseHttpCode = $responseHttpCode;
+ }
+
+ /**
+ * @return $responseHeaders (array) HTTP Response Headers.
+ */
+ public function getResponseHeaders()
+ {
+ return $this->responseHeaders;
+ }
+
+ /**
+ * @return string HTTP Response Body
+ */
+ public function getResponseBody()
+ {
+ return $this->responseBody;
+ }
+
+ /**
+ * Set the class the response to this request should expect.
+ *
+ * @param $class string the class name
+ */
+ public function setExpectedClass($class)
+ {
+ $this->expectedClass = $class;
+ }
+
+ /**
+ * Retrieve the expected class the response should expect.
+ * @return string class name
+ */
+ public function getExpectedClass()
+ {
+ return $this->expectedClass;
+ }
+
+ /**
+ * @param array $headers The HTTP response headers
+ * to be normalized.
+ */
+ public function setResponseHeaders($headers)
+ {
+ $headers = Google_Utils::normalize($headers);
+ if ($this->responseHeaders) {
+ $headers = array_merge($this->responseHeaders, $headers);
+ }
+
+ $this->responseHeaders = $headers;
+ }
+
+ /**
+ * @param string $key
+ * @return array|boolean Returns the requested HTTP header or
+ * false if unavailable.
+ */
+ public function getResponseHeader($key)
+ {
+ return isset($this->responseHeaders[$key])
+ ? $this->responseHeaders[$key]
+ : false;
+ }
+
+ /**
+ * @param string $responseBody The HTTP response body.
+ */
+ public function setResponseBody($responseBody)
+ {
+ $this->responseBody = $responseBody;
+ }
+
+ /**
+ * @return string $url The request URL.
+ */
+ public function getUrl()
+ {
+ return $this->baseComponent . $this->path .
+ (count($this->queryParams) ?
+ "?" . $this->buildQuery($this->queryParams) :
+ '');
+ }
+
+ /**
+ * @return string $method HTTP Request Method.
+ */
+ public function getRequestMethod()
+ {
+ return $this->requestMethod;
+ }
+
+ /**
+ * @return array $headers HTTP Request Headers.
+ */
+ public function getRequestHeaders()
+ {
+ return $this->requestHeaders;
+ }
+
+ /**
+ * @param string $key
+ * @return array|boolean Returns the requested HTTP header or
+ * false if unavailable.
+ */
+ public function getRequestHeader($key)
+ {
+ return isset($this->requestHeaders[$key])
+ ? $this->requestHeaders[$key]
+ : false;
+ }
+
+ /**
+ * @return string $postBody HTTP Request Body.
+ */
+ public function getPostBody()
+ {
+ return $this->postBody;
+ }
+
+ /**
+ * @param string $url the url to set
+ */
+ public function setUrl($url)
+ {
+ if (substr($url, 0, 4) != 'http') {
+ // Force the path become relative.
+ if (substr($url, 0, 1) !== '/') {
+ $url = '/' . $url;
+ }
+ }
+ $parts = parse_url($url);
+ if (isset($parts['host'])) {
+ $this->baseComponent = sprintf(
+ "%s%s%s",
+ isset($parts['scheme']) ? $parts['scheme'] . "://" : '',
+ isset($parts['host']) ? $parts['host'] : '',
+ isset($parts['port']) ? ":" . $parts['port'] : ''
+ );
+ }
+ $this->path = isset($parts['path']) ? $parts['path'] : '';
+ $this->queryParams = array();
+ if (isset($parts['query'])) {
+ $this->queryParams = $this->parseQuery($parts['query']);
+ }
+ }
+
+ /**
+ * @param string $method Set he HTTP Method and normalize
+ * it to upper-case, as required by HTTP.
+ *
+ */
+ public function setRequestMethod($method)
+ {
+ $this->requestMethod = strtoupper($method);
+ }
+
+ /**
+ * @param array $headers The HTTP request headers
+ * to be set and normalized.
+ */
+ public function setRequestHeaders($headers)
+ {
+ $headers = Google_Utils::normalize($headers);
+ if ($this->requestHeaders) {
+ $headers = array_merge($this->requestHeaders, $headers);
+ }
+ $this->requestHeaders = $headers;
+ }
+
+ /**
+ * @param string $postBody the postBody to set
+ */
+ public function setPostBody($postBody)
+ {
+ $this->postBody = $postBody;
+ }
+
+ /**
+ * Set the User-Agent Header.
+ * @param string $userAgent The User-Agent.
+ */
+ public function setUserAgent($userAgent)
+ {
+ $this->userAgent = $userAgent;
+ if ($this->canGzip) {
+ $this->userAgent = $userAgent . self::GZIP_UA;
+ }
+ }
+
+ /**
+ * @return string The User-Agent.
+ */
+ public function getUserAgent()
+ {
+ return $this->userAgent;
+ }
+
+ /**
+ * Returns a cache key depending on if this was an OAuth signed request
+ * in which case it will use the non-signed url and access key to make this
+ * cache key unique per authenticated user, else use the plain request url
+ * @return string The md5 hash of the request cache key.
+ */
+ public function getCacheKey()
+ {
+ $key = $this->getUrl();
+
+ if (isset($this->accessKey)) {
+ $key .= $this->accessKey;
+ }
+
+ if (isset($this->requestHeaders['authorization'])) {
+ $key .= $this->requestHeaders['authorization'];
+ }
+
+ return md5($key);
+ }
+
+ public function getParsedCacheControl()
+ {
+ $parsed = array();
+ $rawCacheControl = $this->getResponseHeader('cache-control');
+ if ($rawCacheControl) {
+ $rawCacheControl = str_replace(', ', '&', $rawCacheControl);
+ parse_str($rawCacheControl, $parsed);
+ }
+
+ return $parsed;
+ }
+
+ /**
+ * @param string $id
+ * @return string A string representation of the HTTP Request.
+ */
+ public function toBatchString($id)
+ {
+ $str = '';
+ $path = parse_url($this->getUrl(), PHP_URL_PATH) . "?" .
+ http_build_query($this->queryParams);
+ $str .= $this->getRequestMethod() . ' ' . $path . " HTTP/1.1\n";
+
+ foreach ($this->getRequestHeaders() as $key => $val) {
+ $str .= $key . ': ' . $val . "\n";
+ }
+
+ if ($this->getPostBody()) {
+ $str .= "\n";
+ $str .= $this->getPostBody();
+ }
+
+ $headers = '';
+ foreach ($this->batchHeaders as $key => $val) {
+ $headers .= $key . ': ' . $val . "\n";
+ }
+
+ $headers .= "Content-ID: $id\n";
+ $str = $headers . "\n" . $str;
+
+ return $str;
+ }
+
+ /**
+ * Our own version of parse_str that allows for multiple variables
+ * with the same name.
+ * @param $string - the query string to parse
+ */
+ private function parseQuery($string)
+ {
+ $return = array();
+ $parts = explode("&", $string);
+ foreach ($parts as $part) {
+ list($key, $value) = explode('=', $part, 2);
+ $value = urldecode($value);
+ if (isset($return[$key])) {
+ if (!is_array($return[$key])) {
+ $return[$key] = array($return[$key]);
+ }
+ $return[$key][] = $value;
+ } else {
+ $return[$key] = $value;
+ }
+ }
+ return $return;
+ }
+
+ /**
+ * A version of build query that allows for multiple
+ * duplicate keys.
+ * @param $parts array of key value pairs
+ */
+ private function buildQuery($parts)
+ {
+ $return = array();
+ foreach ($parts as $key => $value) {
+ if (is_array($value)) {
+ foreach ($value as $v) {
+ $return[] = urlencode($key) . "=" . urlencode($v);
+ }
+ } else {
+ $return[] = urlencode($key) . "=" . urlencode($value);
+ }
+ }
+ return implode('&', $return);
+ }
+
+ /**
+ * If we're POSTing and have no body to send, we can send the query
+ * parameters in there, which avoids length issues with longer query
+ * params.
+ */
+ public function maybeMoveParametersToBody()
+ {
+ if ($this->getRequestMethod() == "POST" && empty($this->postBody)) {
+ $this->setRequestHeaders(
+ array(
+ "content-type" =>
+ "application/x-www-form-urlencoded; charset=UTF-8"
+ )
+ );
+ $this->setPostBody($this->buildQuery($this->queryParams));
+ $this->queryParams = array();
+ }
+ }
+}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/IO/Abstract.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/IO/Abstract.php
new file mode 100644
index 00000000000..a4025e874ad
--- /dev/null
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/IO/Abstract.php
@@ -0,0 +1,332 @@
+<?php
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Abstract IO base class
+ */
+
+require_once 'Google/Client.php';
+require_once 'Google/IO/Exception.php';
+require_once 'Google/Http/CacheParser.php';
+require_once 'Google/Http/Request.php';
+
+abstract class Google_IO_Abstract
+{
+ const UNKNOWN_CODE = 0;
+ const FORM_URLENCODED = 'application/x-www-form-urlencoded';
+ private static $CONNECTION_ESTABLISHED_HEADERS = array(
+ "HTTP/1.0 200 Connection established\r\n\r\n",
+ "HTTP/1.1 200 Connection established\r\n\r\n",
+ );
+ private static $ENTITY_HTTP_METHODS = array("POST" => null, "PUT" => null);
+
+ /** @var Google_Client */
+ protected $client;
+
+ public function __construct(Google_Client $client)
+ {
+ $this->client = $client;
+ $timeout = $client->getClassConfig('Google_IO_Abstract', 'request_timeout_seconds');
+ if ($timeout > 0) {
+ $this->setTimeout($timeout);
+ }
+ }
+
+ /**
+ * Executes a Google_Http_Request and returns the resulting populated Google_Http_Request
+ * @param Google_Http_Request $request
+ * @return Google_Http_Request $request
+ */
+ abstract public function executeRequest(Google_Http_Request $request);
+
+ /**
+ * Set options that update the transport implementation's behavior.
+ * @param $options
+ */
+ abstract public function setOptions($options);
+
+ /**
+ * Set the maximum request time in seconds.
+ * @param $timeout in seconds
+ */
+ abstract public function setTimeout($timeout);
+
+ /**
+ * Get the maximum request time in seconds.
+ * @return timeout in seconds
+ */
+ abstract public function getTimeout();
+
+ /**
+ * Test for the presence of a cURL header processing bug
+ *
+ * The cURL bug was present in versions prior to 7.30.0 and caused the header
+ * length to be miscalculated when a "Connection established" header added by
+ * some proxies was present.
+ *
+ * @return boolean
+ */
+ abstract protected function needsQuirk();
+
+ /**
+ * @visible for testing.
+ * Cache the response to an HTTP request if it is cacheable.
+ * @param Google_Http_Request $request
+ * @return bool Returns true if the insertion was successful.
+ * Otherwise, return false.
+ */
+ public function setCachedRequest(Google_Http_Request $request)
+ {
+ // Determine if the request is cacheable.
+ if (Google_Http_CacheParser::isResponseCacheable($request)) {
+ $this->client->getCache()->set($request->getCacheKey(), $request);
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Execute an HTTP Request
+ *
+ * @param Google_HttpRequest $request the http request to be executed
+ * @return Google_HttpRequest http request with the response http code,
+ * response headers and response body filled in
+ * @throws Google_IO_Exception on curl or IO error
+ */
+ public function makeRequest(Google_Http_Request $request)
+ {
+ // First, check to see if we have a valid cached version.
+ $cached = $this->getCachedRequest($request);
+ if ($cached !== false && $cached instanceof Google_Http_Request) {
+ if (!$this->checkMustRevalidateCachedRequest($cached, $request)) {
+ return $cached;
+ }
+ }
+
+ if (array_key_exists($request->getRequestMethod(), self::$ENTITY_HTTP_METHODS)) {
+ $request = $this->processEntityRequest($request);
+ }
+
+ list($responseData, $responseHeaders, $respHttpCode) = $this->executeRequest($request);
+
+ if ($respHttpCode == 304 && $cached) {
+ // If the server responded NOT_MODIFIED, return the cached request.
+ $this->updateCachedRequest($cached, $responseHeaders);
+ return $cached;
+ }
+
+ if (!isset($responseHeaders['Date']) && !isset($responseHeaders['date'])) {
+ $responseHeaders['Date'] = date("r");
+ }
+
+ $request->setResponseHttpCode($respHttpCode);
+ $request->setResponseHeaders($responseHeaders);
+ $request->setResponseBody($responseData);
+ // Store the request in cache (the function checks to see if the request
+ // can actually be cached)
+ $this->setCachedRequest($request);
+ return $request;
+ }
+
+ /**
+ * @visible for testing.
+ * @param Google_Http_Request $request
+ * @return Google_Http_Request|bool Returns the cached object or
+ * false if the operation was unsuccessful.
+ */
+ public function getCachedRequest(Google_Http_Request $request)
+ {
+ if (false === Google_Http_CacheParser::isRequestCacheable($request)) {
+ return false;
+ }
+
+ return $this->client->getCache()->get($request->getCacheKey());
+ }
+
+ /**
+ * @visible for testing
+ * Process an http request that contains an enclosed entity.
+ * @param Google_Http_Request $request
+ * @return Google_Http_Request Processed request with the enclosed entity.
+ */
+ public function processEntityRequest(Google_Http_Request $request)
+ {
+ $postBody = $request->getPostBody();
+ $contentType = $request->getRequestHeader("content-type");
+
+ // Set the default content-type as application/x-www-form-urlencoded.
+ if (false == $contentType) {
+ $contentType = self::FORM_URLENCODED;
+ $request->setRequestHeaders(array('content-type' => $contentType));
+ }
+
+ // Force the payload to match the content-type asserted in the header.
+ if ($contentType == self::FORM_URLENCODED && is_array($postBody)) {
+ $postBody = http_build_query($postBody, '', '&');
+ $request->setPostBody($postBody);
+ }
+
+ // Make sure the content-length header is set.
+ if (!$postBody || is_string($postBody)) {
+ $postsLength = strlen($postBody);
+ $request->setRequestHeaders(array('content-length' => $postsLength));
+ }
+
+ return $request;
+ }
+
+ /**
+ * Check if an already cached request must be revalidated, and if so update
+ * the request with the correct ETag headers.
+ * @param Google_Http_Request $cached A previously cached response.
+ * @param Google_Http_Request $request The outbound request.
+ * return bool If the cached object needs to be revalidated, false if it is
+ * still current and can be re-used.
+ */
+ protected function checkMustRevalidateCachedRequest($cached, $request)
+ {
+ if (Google_Http_CacheParser::mustRevalidate($cached)) {
+ $addHeaders = array();
+ if ($cached->getResponseHeader('etag')) {
+ // [13.3.4] If an entity tag has been provided by the origin server,
+ // we must use that entity tag in any cache-conditional request.
+ $addHeaders['If-None-Match'] = $cached->getResponseHeader('etag');
+ } elseif ($cached->getResponseHeader('date')) {
+ $addHeaders['If-Modified-Since'] = $cached->getResponseHeader('date');
+ }
+
+ $request->setRequestHeaders($addHeaders);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Update a cached request, using the headers from the last response.
+ * @param Google_HttpRequest $cached A previously cached response.
+ * @param mixed Associative array of response headers from the last request.
+ */
+ protected function updateCachedRequest($cached, $responseHeaders)
+ {
+ if (isset($responseHeaders['connection'])) {
+ $hopByHop = array_merge(
+ self::$HOP_BY_HOP,
+ explode(
+ ',',
+ $responseHeaders['connection']
+ )
+ );
+
+ $endToEnd = array();
+ foreach ($hopByHop as $key) {
+ if (isset($responseHeaders[$key])) {
+ $endToEnd[$key] = $responseHeaders[$key];
+ }
+ }
+ $cached->setResponseHeaders($endToEnd);
+ }
+ }
+
+ /**
+ * Used by the IO lib and also the batch processing.
+ *
+ * @param $respData
+ * @param $headerSize
+ * @return array
+ */
+ public function parseHttpResponse($respData, $headerSize)
+ {
+ // check proxy header
+ foreach (self::$CONNECTION_ESTABLISHED_HEADERS as $established_header) {
+ if (stripos($respData, $established_header) !== false) {
+ // existed, remove it
+ $respData = str_ireplace($established_header, '', $respData);
+ // Subtract the proxy header size unless the cURL bug prior to 7.30.0
+ // is present which prevented the proxy header size from being taken into
+ // account.
+ if (!$this->needsQuirk()) {
+ $headerSize -= strlen($established_header);
+ }
+ break;
+ }
+ }
+
+ if ($headerSize) {
+ $responseBody = substr($respData, $headerSize);
+ $responseHeaders = substr($respData, 0, $headerSize);
+ } else {
+ $responseSegments = explode("\r\n\r\n", $respData, 2);
+ $responseHeaders = $responseSegments[0];
+ $responseBody = isset($responseSegments[1]) ? $responseSegments[1] :
+ null;
+ }
+
+ $responseHeaders = $this->getHttpResponseHeaders($responseHeaders);
+ return array($responseHeaders, $responseBody);
+ }
+
+ /**
+ * Parse out headers from raw headers
+ * @param rawHeaders array or string
+ * @return array
+ */
+ public function getHttpResponseHeaders($rawHeaders)
+ {
+ if (is_array($rawHeaders)) {
+ return $this->parseArrayHeaders($rawHeaders);
+ } else {
+ return $this->parseStringHeaders($rawHeaders);
+ }
+ }
+
+ private function parseStringHeaders($rawHeaders)
+ {
+ $headers = array();
+ $responseHeaderLines = explode("\r\n", $rawHeaders);
+ foreach ($responseHeaderLines as $headerLine) {
+ if ($headerLine && strpos($headerLine, ':') !== false) {
+ list($header, $value) = explode(': ', $headerLine, 2);
+ $header = strtolower($header);
+ if (isset($headers[$header])) {
+ $headers[$header] .= "\n" . $value;
+ } else {
+ $headers[$header] = $value;
+ }
+ }
+ }
+ return $headers;
+ }
+
+ private function parseArrayHeaders($rawHeaders)
+ {
+ $header_count = count($rawHeaders);
+ $headers = array();
+
+ for ($i = 0; $i < $header_count; $i++) {
+ $header = $rawHeaders[$i];
+ // Times will have colons in - so we just want the first match.
+ $header_parts = explode(': ', $header, 2);
+ if (count($header_parts) == 2) {
+ $headers[$header_parts[0]] = $header_parts[1];
+ }
+ }
+
+ return $headers;
+ }
+}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/IO/Curl.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/IO/Curl.php
new file mode 100644
index 00000000000..57a057114cc
--- /dev/null
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/IO/Curl.php
@@ -0,0 +1,137 @@
+<?php
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Curl based implementation of Google_IO.
+ *
+ * @author Stuart Langley <slangley@google.com>
+ */
+
+require_once 'Google/IO/Abstract.php';
+
+class Google_IO_Curl extends Google_IO_Abstract
+{
+ // cURL hex representation of version 7.30.0
+ const NO_QUIRK_VERSION = 0x071E00;
+
+ private $options = array();
+ /**
+ * Execute an HTTP Request
+ *
+ * @param Google_HttpRequest $request the http request to be executed
+ * @return Google_HttpRequest http request with the response http code,
+ * response headers and response body filled in
+ * @throws Google_IO_Exception on curl or IO error
+ */
+ public function executeRequest(Google_Http_Request $request)
+ {
+ $curl = curl_init();
+
+ if ($request->getPostBody()) {
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $request->getPostBody());
+ }
+
+ $requestHeaders = $request->getRequestHeaders();
+ if ($requestHeaders && is_array($requestHeaders)) {
+ $curlHeaders = array();
+ foreach ($requestHeaders as $k => $v) {
+ $curlHeaders[] = "$k: $v";
+ }
+ curl_setopt($curl, CURLOPT_HTTPHEADER, $curlHeaders);
+ }
+
+ curl_setopt($curl, CURLOPT_URL, $request->getUrl());
+
+ curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $request->getRequestMethod());
+ curl_setopt($curl, CURLOPT_USERAGENT, $request->getUserAgent());
+
+ curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false);
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($curl, CURLOPT_HEADER, true);
+
+ if ($request->canGzip()) {
+ curl_setopt($curl, CURLOPT_ENCODING, 'gzip,deflate');
+ }
+
+ foreach ($this->options as $key => $var) {
+ curl_setopt($curl, $key, $var);
+ }
+
+ if (!isset($this->options[CURLOPT_CAINFO])) {
+ curl_setopt($curl, CURLOPT_CAINFO, dirname(__FILE__) . '/cacerts.pem');
+ }
+
+ $response = curl_exec($curl);
+ if ($response === false) {
+ throw new Google_IO_Exception(curl_error($curl));
+ }
+ $headerSize = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
+
+ list($responseHeaders, $responseBody) = $this->parseHttpResponse($response, $headerSize);
+
+ $responseCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
+
+ return array($responseBody, $responseHeaders, $responseCode);
+ }
+
+ /**
+ * Set options that update the transport implementation's behavior.
+ * @param $options
+ */
+ public function setOptions($options)
+ {
+ $this->options = $options + $this->options;
+ }
+
+ /**
+ * Set the maximum request time in seconds.
+ * @param $timeout in seconds
+ */
+ public function setTimeout($timeout)
+ {
+ // Since this timeout is really for putting a bound on the time
+ // we'll set them both to the same. If you need to specify a longer
+ // CURLOPT_TIMEOUT, or a tigher CONNECTTIMEOUT, the best thing to
+ // do is use the setOptions method for the values individually.
+ $this->options[CURLOPT_CONNECTTIMEOUT] = $timeout;
+ $this->options[CURLOPT_TIMEOUT] = $timeout;
+ }
+
+ /**
+ * Get the maximum request time in seconds.
+ * @return timeout in seconds
+ */
+ public function getTimeout()
+ {
+ return $this->options[CURLOPT_TIMEOUT];
+ }
+
+ /**
+ * Test for the presence of a cURL header processing bug
+ *
+ * {@inheritDoc}
+ *
+ * @return boolean
+ */
+ protected function needsQuirk()
+ {
+ $ver = curl_version();
+ $versionNum = $ver['version_number'];
+ return $versionNum < Google_IO_Curl::NO_QUIRK_VERSION;
+ }
+}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/IO/Exception.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/IO/Exception.php
new file mode 100644
index 00000000000..28c2d8ce645
--- /dev/null
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/IO/Exception.php
@@ -0,0 +1,22 @@
+<?php
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+require_once 'Google/Exception.php';
+
+class Google_IO_Exception extends Google_Exception
+{
+}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/IO/Stream.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/IO/Stream.php
new file mode 100644
index 00000000000..917578d87a0
--- /dev/null
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/IO/Stream.php
@@ -0,0 +1,211 @@
+<?php
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Http Streams based implementation of Google_IO.
+ *
+ * @author Stuart Langley <slangley@google.com>
+ */
+
+require_once 'Google/IO/Abstract.php';
+
+class Google_IO_Stream extends Google_IO_Abstract
+{
+ const TIMEOUT = "timeout";
+ const ZLIB = "compress.zlib://";
+ private $options = array();
+ private $trappedErrorNumber;
+ private $trappedErrorString;
+
+ private static $DEFAULT_HTTP_CONTEXT = array(
+ "follow_location" => 0,
+ "ignore_errors" => 1,
+ );
+
+ private static $DEFAULT_SSL_CONTEXT = array(
+ "verify_peer" => true,
+ );
+
+ /**
+ * Execute an HTTP Request
+ *
+ * @param Google_HttpRequest $request the http request to be executed
+ * @return Google_HttpRequest http request with the response http code,
+ * response headers and response body filled in
+ * @throws Google_IO_Exception on curl or IO error
+ */
+ public function executeRequest(Google_Http_Request $request)
+ {
+ $default_options = stream_context_get_options(stream_context_get_default());
+
+ $requestHttpContext = array_key_exists('http', $default_options) ?
+ $default_options['http'] : array();
+
+ if ($request->getPostBody()) {
+ $requestHttpContext["content"] = $request->getPostBody();
+ }
+
+ $requestHeaders = $request->getRequestHeaders();
+ if ($requestHeaders && is_array($requestHeaders)) {
+ $headers = "";
+ foreach ($requestHeaders as $k => $v) {
+ $headers .= "$k: $v\r\n";
+ }
+ $requestHttpContext["header"] = $headers;
+ }
+
+ $requestHttpContext["method"] = $request->getRequestMethod();
+ $requestHttpContext["user_agent"] = $request->getUserAgent();
+
+ $requestSslContext = array_key_exists('ssl', $default_options) ?
+ $default_options['ssl'] : array();
+
+ if (!array_key_exists("cafile", $requestSslContext)) {
+ $requestSslContext["cafile"] = dirname(__FILE__) . '/cacerts.pem';
+ }
+
+ $options = array(
+ "http" => array_merge(
+ self::$DEFAULT_HTTP_CONTEXT,
+ $requestHttpContext
+ ),
+ "ssl" => array_merge(
+ self::$DEFAULT_SSL_CONTEXT,
+ $requestSslContext
+ )
+ );
+
+ $context = stream_context_create($options);
+
+ $url = $request->getUrl();
+
+ if ($request->canGzip()) {
+ $url = self::ZLIB . $url;
+ }
+
+ // We are trapping any thrown errors in this method only and
+ // throwing an exception.
+ $this->trappedErrorNumber = null;
+ $this->trappedErrorString = null;
+
+ // START - error trap.
+ set_error_handler(array($this, 'trapError'));
+ $fh = fopen($url, 'r', false, $context);
+ restore_error_handler();
+ // END - error trap.
+
+ if ($this->trappedErrorNumber) {
+ throw new Google_IO_Exception(
+ sprintf(
+ "HTTP Error: Unable to connect: '%s'",
+ $this->trappedErrorString
+ ),
+ $this->trappedErrorNumber
+ );
+ }
+
+ $response_data = false;
+ $respHttpCode = self::UNKNOWN_CODE;
+ if ($fh) {
+ if (isset($this->options[self::TIMEOUT])) {
+ stream_set_timeout($fh, $this->options[self::TIMEOUT]);
+ }
+
+ $response_data = stream_get_contents($fh);
+ fclose($fh);
+
+ $respHttpCode = $this->getHttpResponseCode($http_response_header);
+ }
+
+ if (false === $response_data) {
+ throw new Google_IO_Exception(
+ sprintf(
+ "HTTP Error: Unable to connect: '%s'",
+ $respHttpCode
+ ),
+ $respHttpCode
+ );
+ }
+
+ $responseHeaders = $this->getHttpResponseHeaders($http_response_header);
+
+ return array($response_data, $responseHeaders, $respHttpCode);
+ }
+
+ /**
+ * Set options that update the transport implementation's behavior.
+ * @param $options
+ */
+ public function setOptions($options)
+ {
+ $this->options = $options + $this->options;
+ }
+
+ /**
+ * Method to handle errors, used for error handling around
+ * stream connection methods.
+ */
+ public function trapError($errno, $errstr)
+ {
+ $this->trappedErrorNumber = $errno;
+ $this->trappedErrorString = $errstr;
+ }
+
+ /**
+ * Set the maximum request time in seconds.
+ * @param $timeout in seconds
+ */
+ public function setTimeout($timeout)
+ {
+ $this->options[self::TIMEOUT] = $timeout;
+ }
+
+ /**
+ * Get the maximum request time in seconds.
+ * @return timeout in seconds
+ */
+ public function getTimeout()
+ {
+ return $this->options[self::TIMEOUT];
+ }
+
+ /**
+ * Test for the presence of a cURL header processing bug
+ *
+ * {@inheritDoc}
+ *
+ * @return boolean
+ */
+ protected function needsQuirk()
+ {
+ return false;
+ }
+
+ protected function getHttpResponseCode($response_headers)
+ {
+ $header_count = count($response_headers);
+
+ for ($i = 0; $i < $header_count; $i++) {
+ $header = $response_headers[$i];
+ if (strncasecmp("HTTP", $header, strlen("HTTP")) == 0) {
+ $response = explode(' ', $header);
+ return $response[1];
+ }
+ }
+ return self::UNKNOWN_CODE;
+ }
+}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/io/cacerts.pem b/apps/files_external/3rdparty/google-api-php-client/src/Google/IO/cacerts.pem
index da36ed1ba6d..79a49289cbe 100644
--- a/apps/files_external/3rdparty/google-api-php-client/src/io/cacerts.pem
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/IO/cacerts.pem
@@ -712,3 +712,27 @@ IYEZoDJJKPTEjlbVUjP9UNV+mWwD5MlM/Mtsq2azSiGM5bUMMj4QssxsodyamEwC
W/POuZ6lcg5Ktz885hZo+L7tdEy8W9ViH0Pd
-----END CERTIFICATE-----
+GeoTrust Global CA
+==================
+
+-----BEGIN CERTIFICATE-----
+MIIDfTCCAuagAwIBAgIDErvmMA0GCSqGSIb3DQEBBQUAME4xCzAJBgNVBAYTAlVT
+MRAwDgYDVQQKEwdFcXVpZmF4MS0wKwYDVQQLEyRFcXVpZmF4IFNlY3VyZSBDZXJ0
+aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDIwNTIxMDQwMDAwWhcNMTgwODIxMDQwMDAw
+WjBCMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEbMBkGA1UE
+AxMSR2VvVHJ1c3QgR2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
+CgKCAQEA2swYYzD99BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9m
+OSm9BXiLnTjoBbdqfnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIu
+T8rxh0PBFpVXLVDviS2Aelet8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6c
+JmTM386DGXHKTubU1XupGc1V3sjs0l44U+VcT4wt/lAjNvxm5suOpDkZALeVAjmR
+Cw7+OC7RHQWa9k0+bw8HHa8sHo9gOeL6NlMTOdReJivbPagUvTLrGAMoUgRx5asz
+PeE4uwc2hGKceeoWMPRfwCvocWvk+QIDAQABo4HwMIHtMB8GA1UdIwQYMBaAFEjm
+aPkr0rKV10fYIyAQTzOYkJ/UMB0GA1UdDgQWBBTAephojYn7qwVkDBF9qn1luMrM
+TjAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjA6BgNVHR8EMzAxMC+g
+LaArhilodHRwOi8vY3JsLmdlb3RydXN0LmNvbS9jcmxzL3NlY3VyZWNhLmNybDBO
+BgNVHSAERzBFMEMGBFUdIAAwOzA5BggrBgEFBQcCARYtaHR0cHM6Ly93d3cuZ2Vv
+dHJ1c3QuY29tL3Jlc291cmNlcy9yZXBvc2l0b3J5MA0GCSqGSIb3DQEBBQUAA4GB
+AHbhEm5OSxYShjAGsoEIz/AIx8dxfmbuwu3UOx//8PDITtZDOLC5MH0Y0FWDomrL
+NhGc6Ehmo21/uBPUR/6LWlxz/K7ZGzIZOKuXNBSqltLroxwUCEm2u+WR74M26x1W
+b8ravHNjkOR/ez4iyz0H7V84dJzjA1BOoa+Y7mHyhD8S
+-----END CERTIFICATE-----
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Model.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Model.php
new file mode 100644
index 00000000000..2bb9a333d66
--- /dev/null
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Model.php
@@ -0,0 +1,265 @@
+<?php
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * This class defines attributes, valid values, and usage which is generated
+ * from a given json schema.
+ * http://tools.ietf.org/html/draft-zyp-json-schema-03#section-5
+ *
+ * @author Chirag Shah <chirags@google.com>
+ *
+ */
+class Google_Model implements ArrayAccess
+{
+ protected $internal_gapi_mappings = array();
+ protected $modelData = array();
+ protected $processed = array();
+
+ /**
+ * Polymorphic - accepts a variable number of arguments dependent
+ * on the type of the model subclass.
+ */
+ public function __construct()
+ {
+ if (func_num_args() == 1 && is_array(func_get_arg(0))) {
+ // Initialize the model with the array's contents.
+ $array = func_get_arg(0);
+ $this->mapTypes($array);
+ }
+ }
+
+ public function __get($key)
+ {
+ $keyTypeName = $this->keyType($key);
+ $keyDataType = $this->dataType($key);
+ if (isset($this->$keyTypeName) && !isset($this->processed[$key])) {
+ if (isset($this->modelData[$key])) {
+ $val = $this->modelData[$key];
+ } else if (isset($this->$keyDataType) &&
+ ($this->$keyDataType == 'array' || $this->$keyDataType == 'map')) {
+ $val = array();
+ } else {
+ $val = null;
+ }
+
+ if ($this->isAssociativeArray($val)) {
+ if (isset($this->$keyDataType) && 'map' == $this->$keyDataType) {
+ foreach ($val as $arrayKey => $arrayItem) {
+ $this->modelData[$key][$arrayKey] =
+ $this->createObjectFromName($keyTypeName, $arrayItem);
+ }
+ } else {
+ $this->modelData[$key] = $this->createObjectFromName($keyTypeName, $val);
+ }
+ } else if (is_array($val)) {
+ $arrayObject = array();
+ foreach ($val as $arrayIndex => $arrayItem) {
+ $arrayObject[$arrayIndex] =
+ $this->createObjectFromName($keyTypeName, $arrayItem);
+ }
+ $this->modelData[$key] = $arrayObject;
+ }
+ $this->processed[$key] = true;
+ }
+
+ return isset($this->modelData[$key]) ? $this->modelData[$key] : null;
+ }
+
+ /**
+ * Initialize this object's properties from an array.
+ *
+ * @param array $array Used to seed this object's properties.
+ * @return void
+ */
+ protected function mapTypes($array)
+ {
+ // Hard initilise simple types, lazy load more complex ones.
+ foreach ($array as $key => $val) {
+ if ( !property_exists($this, $this->keyType($key)) &&
+ property_exists($this, $key)) {
+ $this->$key = $val;
+ unset($array[$key]);
+ } elseif (property_exists($this, $camelKey = Google_Utils::camelCase($key))) {
+ // This checks if property exists as camelCase, leaving it in array as snake_case
+ // in case of backwards compatibility issues.
+ $this->$camelKey = $val;
+ }
+ }
+ $this->modelData = $array;
+ }
+
+ /**
+ * Create a simplified object suitable for straightforward
+ * conversion to JSON. This is relatively expensive
+ * due to the usage of reflection, but shouldn't be called
+ * a whole lot, and is the most straightforward way to filter.
+ */
+ public function toSimpleObject()
+ {
+ $object = new stdClass();
+
+ // Process all other data.
+ foreach ($this->modelData as $key => $val) {
+ $result = $this->getSimpleValue($val);
+ if ($result !== null) {
+ $object->$key = $result;
+ }
+ }
+
+ // Process all public properties.
+ $reflect = new ReflectionObject($this);
+ $props = $reflect->getProperties(ReflectionProperty::IS_PUBLIC);
+ foreach ($props as $member) {
+ $name = $member->getName();
+ $result = $this->getSimpleValue($this->$name);
+ if ($result !== null) {
+ $name = $this->getMappedName($name);
+ $object->$name = $result;
+ }
+ }
+
+ return $object;
+ }
+
+ /**
+ * Handle different types of values, primarily
+ * other objects and map and array data types.
+ */
+ private function getSimpleValue($value)
+ {
+ if ($value instanceof Google_Model) {
+ return $value->toSimpleObject();
+ } else if (is_array($value)) {
+ $return = array();
+ foreach ($value as $key => $a_value) {
+ $a_value = $this->getSimpleValue($a_value);
+ if ($a_value !== null) {
+ $key = $this->getMappedName($key);
+ $return[$key] = $a_value;
+ }
+ }
+ return $return;
+ }
+ return $value;
+ }
+
+ /**
+ * If there is an internal name mapping, use that.
+ */
+ private function getMappedName($key)
+ {
+ if (isset($this->internal_gapi_mappings) &&
+ isset($this->internal_gapi_mappings[$key])) {
+ $key = $this->internal_gapi_mappings[$key];
+ }
+ return $key;
+ }
+
+ /**
+ * Returns true only if the array is associative.
+ * @param array $array
+ * @return bool True if the array is associative.
+ */
+ protected function isAssociativeArray($array)
+ {
+ if (!is_array($array)) {
+ return false;
+ }
+ $keys = array_keys($array);
+ foreach ($keys as $key) {
+ if (is_string($key)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Given a variable name, discover its type.
+ *
+ * @param $name
+ * @param $item
+ * @return object The object from the item.
+ */
+ private function createObjectFromName($name, $item)
+ {
+ $type = $this->$name;
+ return new $type($item);
+ }
+
+ /**
+ * Verify if $obj is an array.
+ * @throws Google_Exception Thrown if $obj isn't an array.
+ * @param array $obj Items that should be validated.
+ * @param string $method Method expecting an array as an argument.
+ */
+ public function assertIsArray($obj, $method)
+ {
+ if ($obj && !is_array($obj)) {
+ throw new Google_Exception(
+ "Incorrect parameter type passed to $method(). Expected an array."
+ );
+ }
+ }
+
+ public function offsetExists($offset)
+ {
+ return isset($this->$offset) || isset($this->modelData[$offset]);
+ }
+
+ public function offsetGet($offset)
+ {
+ return isset($this->$offset) ?
+ $this->$offset :
+ $this->__get($offset);
+ }
+
+ public function offsetSet($offset, $value)
+ {
+ if (property_exists($this, $offset)) {
+ $this->$offset = $value;
+ } else {
+ $this->modelData[$offset] = $value;
+ $this->processed[$offset] = true;
+ }
+ }
+
+ public function offsetUnset($offset)
+ {
+ unset($this->modelData[$offset]);
+ }
+
+ protected function keyType($key)
+ {
+ return $key . "Type";
+ }
+
+ protected function dataType($key)
+ {
+ return $key . "DataType";
+ }
+
+ public function __isset($key)
+ {
+ return isset($this->modelData[$key]);
+ }
+
+ public function __unset($key)
+ {
+ unset($this->modelData[$key]);
+ }
+}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Service.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Service.php
new file mode 100644
index 00000000000..2e0b6c52282
--- /dev/null
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Service.php
@@ -0,0 +1,39 @@
+<?php
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+class Google_Service
+{
+ public $version;
+ public $servicePath;
+ public $availableScopes;
+ public $resource;
+ private $client;
+
+ public function __construct(Google_Client $client)
+ {
+ $this->client = $client;
+ }
+
+ /**
+ * Return the associated Google_Client class.
+ * @return Google_Client
+ */
+ public function getClient()
+ {
+ return $this->client;
+ }
+}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Service/Drive.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Service/Drive.php
new file mode 100644
index 00000000000..291a6091232
--- /dev/null
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Service/Drive.php
@@ -0,0 +1,6136 @@
+<?php
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+/**
+ * Service definition for Drive (v2).
+ *
+ * <p>
+ * The API to interact with Drive.
+ * </p>
+ *
+ * <p>
+ * For more information about this service, see the API
+ * <a href="https://developers.google.com/drive/" target="_blank">Documentation</a>
+ * </p>
+ *
+ * @author Google, Inc.
+ */
+class Google_Service_Drive extends Google_Service
+{
+ /** View and manage the files and documents in your Google Drive. */
+ const DRIVE = "https://www.googleapis.com/auth/drive";
+ /** View and manage its own configuration data in your Google Drive. */
+ const DRIVE_APPDATA = "https://www.googleapis.com/auth/drive.appdata";
+ /** View your Google Drive apps. */
+ const DRIVE_APPS_READONLY = "https://www.googleapis.com/auth/drive.apps.readonly";
+ /** View and manage Google Drive files that you have opened or created with this app. */
+ const DRIVE_FILE = "https://www.googleapis.com/auth/drive.file";
+ /** View metadata for files and documents in your Google Drive. */
+ const DRIVE_METADATA_READONLY = "https://www.googleapis.com/auth/drive.metadata.readonly";
+ /** View the files and documents in your Google Drive. */
+ const DRIVE_READONLY = "https://www.googleapis.com/auth/drive.readonly";
+ /** Modify your Google Apps Script scripts' behavior. */
+ const DRIVE_SCRIPTS = "https://www.googleapis.com/auth/drive.scripts";
+
+ public $about;
+ public $apps;
+ public $changes;
+ public $channels;
+ public $children;
+ public $comments;
+ public $files;
+ public $parents;
+ public $permissions;
+ public $properties;
+ public $realtime;
+ public $replies;
+ public $revisions;
+
+
+ /**
+ * Constructs the internal representation of the Drive service.
+ *
+ * @param Google_Client $client
+ */
+ public function __construct(Google_Client $client)
+ {
+ parent::__construct($client);
+ $this->servicePath = 'drive/v2/';
+ $this->version = 'v2';
+ $this->serviceName = 'drive';
+
+ $this->about = new Google_Service_Drive_About_Resource(
+ $this,
+ $this->serviceName,
+ 'about',
+ array(
+ 'methods' => array(
+ 'get' => array(
+ 'path' => 'about',
+ 'httpMethod' => 'GET',
+ 'parameters' => array(
+ 'includeSubscribed' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ 'maxChangeIdCount' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ 'startChangeId' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ ),
+ ),
+ )
+ )
+ );
+ $this->apps = new Google_Service_Drive_Apps_Resource(
+ $this,
+ $this->serviceName,
+ 'apps',
+ array(
+ 'methods' => array(
+ 'get' => array(
+ 'path' => 'apps/{appId}',
+ 'httpMethod' => 'GET',
+ 'parameters' => array(
+ 'appId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),'list' => array(
+ 'path' => 'apps',
+ 'httpMethod' => 'GET',
+ 'parameters' => array(
+ 'languageCode' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ 'appFilterExtensions' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ 'appFilterMimeTypes' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ ),
+ ),
+ )
+ )
+ );
+ $this->changes = new Google_Service_Drive_Changes_Resource(
+ $this,
+ $this->serviceName,
+ 'changes',
+ array(
+ 'methods' => array(
+ 'get' => array(
+ 'path' => 'changes/{changeId}',
+ 'httpMethod' => 'GET',
+ 'parameters' => array(
+ 'changeId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),'list' => array(
+ 'path' => 'changes',
+ 'httpMethod' => 'GET',
+ 'parameters' => array(
+ 'includeSubscribed' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ 'startChangeId' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ 'includeDeleted' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ 'maxResults' => array(
+ 'location' => 'query',
+ 'type' => 'integer',
+ ),
+ 'pageToken' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ ),
+ ),'watch' => array(
+ 'path' => 'changes/watch',
+ 'httpMethod' => 'POST',
+ 'parameters' => array(
+ 'includeSubscribed' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ 'startChangeId' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ 'includeDeleted' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ 'maxResults' => array(
+ 'location' => 'query',
+ 'type' => 'integer',
+ ),
+ 'pageToken' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ ),
+ ),
+ )
+ )
+ );
+ $this->channels = new Google_Service_Drive_Channels_Resource(
+ $this,
+ $this->serviceName,
+ 'channels',
+ array(
+ 'methods' => array(
+ 'stop' => array(
+ 'path' => 'channels/stop',
+ 'httpMethod' => 'POST',
+ 'parameters' => array(),
+ ),
+ )
+ )
+ );
+ $this->children = new Google_Service_Drive_Children_Resource(
+ $this,
+ $this->serviceName,
+ 'children',
+ array(
+ 'methods' => array(
+ 'delete' => array(
+ 'path' => 'files/{folderId}/children/{childId}',
+ 'httpMethod' => 'DELETE',
+ 'parameters' => array(
+ 'folderId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'childId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),'get' => array(
+ 'path' => 'files/{folderId}/children/{childId}',
+ 'httpMethod' => 'GET',
+ 'parameters' => array(
+ 'folderId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'childId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),'insert' => array(
+ 'path' => 'files/{folderId}/children',
+ 'httpMethod' => 'POST',
+ 'parameters' => array(
+ 'folderId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),'list' => array(
+ 'path' => 'files/{folderId}/children',
+ 'httpMethod' => 'GET',
+ 'parameters' => array(
+ 'folderId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'q' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ 'pageToken' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ 'maxResults' => array(
+ 'location' => 'query',
+ 'type' => 'integer',
+ ),
+ ),
+ ),
+ )
+ )
+ );
+ $this->comments = new Google_Service_Drive_Comments_Resource(
+ $this,
+ $this->serviceName,
+ 'comments',
+ array(
+ 'methods' => array(
+ 'delete' => array(
+ 'path' => 'files/{fileId}/comments/{commentId}',
+ 'httpMethod' => 'DELETE',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'commentId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),'get' => array(
+ 'path' => 'files/{fileId}/comments/{commentId}',
+ 'httpMethod' => 'GET',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'commentId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'includeDeleted' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ ),
+ ),'insert' => array(
+ 'path' => 'files/{fileId}/comments',
+ 'httpMethod' => 'POST',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),'list' => array(
+ 'path' => 'files/{fileId}/comments',
+ 'httpMethod' => 'GET',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'pageToken' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ 'updatedMin' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ 'includeDeleted' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ 'maxResults' => array(
+ 'location' => 'query',
+ 'type' => 'integer',
+ ),
+ ),
+ ),'patch' => array(
+ 'path' => 'files/{fileId}/comments/{commentId}',
+ 'httpMethod' => 'PATCH',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'commentId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),'update' => array(
+ 'path' => 'files/{fileId}/comments/{commentId}',
+ 'httpMethod' => 'PUT',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'commentId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),
+ )
+ )
+ );
+ $this->files = new Google_Service_Drive_Files_Resource(
+ $this,
+ $this->serviceName,
+ 'files',
+ array(
+ 'methods' => array(
+ 'copy' => array(
+ 'path' => 'files/{fileId}/copy',
+ 'httpMethod' => 'POST',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'convert' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ 'ocrLanguage' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ 'visibility' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ 'pinned' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ 'ocr' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ 'timedTextTrackName' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ 'timedTextLanguage' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ ),
+ ),'delete' => array(
+ 'path' => 'files/{fileId}',
+ 'httpMethod' => 'DELETE',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),'emptyTrash' => array(
+ 'path' => 'files/trash',
+ 'httpMethod' => 'DELETE',
+ 'parameters' => array(),
+ ),'get' => array(
+ 'path' => 'files/{fileId}',
+ 'httpMethod' => 'GET',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'updateViewedDate' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ 'projection' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ ),
+ ),'insert' => array(
+ 'path' => 'files',
+ 'httpMethod' => 'POST',
+ 'parameters' => array(
+ 'convert' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ 'useContentAsIndexableText' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ 'ocrLanguage' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ 'visibility' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ 'pinned' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ 'ocr' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ 'timedTextTrackName' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ 'timedTextLanguage' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ ),
+ ),'list' => array(
+ 'path' => 'files',
+ 'httpMethod' => 'GET',
+ 'parameters' => array(
+ 'q' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ 'pageToken' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ 'corpus' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ 'projection' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ 'maxResults' => array(
+ 'location' => 'query',
+ 'type' => 'integer',
+ ),
+ ),
+ ),'patch' => array(
+ 'path' => 'files/{fileId}',
+ 'httpMethod' => 'PATCH',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'addParents' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ 'updateViewedDate' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ 'removeParents' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ 'setModifiedDate' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ 'convert' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ 'useContentAsIndexableText' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ 'ocrLanguage' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ 'pinned' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ 'newRevision' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ 'ocr' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ 'timedTextLanguage' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ 'timedTextTrackName' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ ),
+ ),'touch' => array(
+ 'path' => 'files/{fileId}/touch',
+ 'httpMethod' => 'POST',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),'trash' => array(
+ 'path' => 'files/{fileId}/trash',
+ 'httpMethod' => 'POST',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),'untrash' => array(
+ 'path' => 'files/{fileId}/untrash',
+ 'httpMethod' => 'POST',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),'update' => array(
+ 'path' => 'files/{fileId}',
+ 'httpMethod' => 'PUT',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'addParents' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ 'updateViewedDate' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ 'removeParents' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ 'setModifiedDate' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ 'convert' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ 'useContentAsIndexableText' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ 'ocrLanguage' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ 'pinned' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ 'newRevision' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ 'ocr' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ 'timedTextLanguage' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ 'timedTextTrackName' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ ),
+ ),'watch' => array(
+ 'path' => 'files/{fileId}/watch',
+ 'httpMethod' => 'POST',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'updateViewedDate' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ 'projection' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ ),
+ ),
+ )
+ )
+ );
+ $this->parents = new Google_Service_Drive_Parents_Resource(
+ $this,
+ $this->serviceName,
+ 'parents',
+ array(
+ 'methods' => array(
+ 'delete' => array(
+ 'path' => 'files/{fileId}/parents/{parentId}',
+ 'httpMethod' => 'DELETE',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'parentId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),'get' => array(
+ 'path' => 'files/{fileId}/parents/{parentId}',
+ 'httpMethod' => 'GET',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'parentId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),'insert' => array(
+ 'path' => 'files/{fileId}/parents',
+ 'httpMethod' => 'POST',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),'list' => array(
+ 'path' => 'files/{fileId}/parents',
+ 'httpMethod' => 'GET',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),
+ )
+ )
+ );
+ $this->permissions = new Google_Service_Drive_Permissions_Resource(
+ $this,
+ $this->serviceName,
+ 'permissions',
+ array(
+ 'methods' => array(
+ 'delete' => array(
+ 'path' => 'files/{fileId}/permissions/{permissionId}',
+ 'httpMethod' => 'DELETE',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'permissionId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),'get' => array(
+ 'path' => 'files/{fileId}/permissions/{permissionId}',
+ 'httpMethod' => 'GET',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'permissionId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),'getIdForEmail' => array(
+ 'path' => 'permissionIds/{email}',
+ 'httpMethod' => 'GET',
+ 'parameters' => array(
+ 'email' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),'insert' => array(
+ 'path' => 'files/{fileId}/permissions',
+ 'httpMethod' => 'POST',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'emailMessage' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ 'sendNotificationEmails' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ ),
+ ),'list' => array(
+ 'path' => 'files/{fileId}/permissions',
+ 'httpMethod' => 'GET',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),'patch' => array(
+ 'path' => 'files/{fileId}/permissions/{permissionId}',
+ 'httpMethod' => 'PATCH',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'permissionId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'transferOwnership' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ ),
+ ),'update' => array(
+ 'path' => 'files/{fileId}/permissions/{permissionId}',
+ 'httpMethod' => 'PUT',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'permissionId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'transferOwnership' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ ),
+ ),
+ )
+ )
+ );
+ $this->properties = new Google_Service_Drive_Properties_Resource(
+ $this,
+ $this->serviceName,
+ 'properties',
+ array(
+ 'methods' => array(
+ 'delete' => array(
+ 'path' => 'files/{fileId}/properties/{propertyKey}',
+ 'httpMethod' => 'DELETE',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'propertyKey' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'visibility' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ ),
+ ),'get' => array(
+ 'path' => 'files/{fileId}/properties/{propertyKey}',
+ 'httpMethod' => 'GET',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'propertyKey' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'visibility' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ ),
+ ),'insert' => array(
+ 'path' => 'files/{fileId}/properties',
+ 'httpMethod' => 'POST',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),'list' => array(
+ 'path' => 'files/{fileId}/properties',
+ 'httpMethod' => 'GET',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),'patch' => array(
+ 'path' => 'files/{fileId}/properties/{propertyKey}',
+ 'httpMethod' => 'PATCH',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'propertyKey' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'visibility' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ ),
+ ),'update' => array(
+ 'path' => 'files/{fileId}/properties/{propertyKey}',
+ 'httpMethod' => 'PUT',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'propertyKey' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'visibility' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ ),
+ ),
+ )
+ )
+ );
+ $this->realtime = new Google_Service_Drive_Realtime_Resource(
+ $this,
+ $this->serviceName,
+ 'realtime',
+ array(
+ 'methods' => array(
+ 'get' => array(
+ 'path' => 'files/{fileId}/realtime',
+ 'httpMethod' => 'GET',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'revision' => array(
+ 'location' => 'query',
+ 'type' => 'integer',
+ ),
+ ),
+ ),'update' => array(
+ 'path' => 'files/{fileId}/realtime',
+ 'httpMethod' => 'PUT',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'baseRevision' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ ),
+ ),
+ )
+ )
+ );
+ $this->replies = new Google_Service_Drive_Replies_Resource(
+ $this,
+ $this->serviceName,
+ 'replies',
+ array(
+ 'methods' => array(
+ 'delete' => array(
+ 'path' => 'files/{fileId}/comments/{commentId}/replies/{replyId}',
+ 'httpMethod' => 'DELETE',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'commentId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'replyId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),'get' => array(
+ 'path' => 'files/{fileId}/comments/{commentId}/replies/{replyId}',
+ 'httpMethod' => 'GET',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'commentId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'replyId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'includeDeleted' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ ),
+ ),'insert' => array(
+ 'path' => 'files/{fileId}/comments/{commentId}/replies',
+ 'httpMethod' => 'POST',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'commentId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),'list' => array(
+ 'path' => 'files/{fileId}/comments/{commentId}/replies',
+ 'httpMethod' => 'GET',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'commentId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'pageToken' => array(
+ 'location' => 'query',
+ 'type' => 'string',
+ ),
+ 'includeDeleted' => array(
+ 'location' => 'query',
+ 'type' => 'boolean',
+ ),
+ 'maxResults' => array(
+ 'location' => 'query',
+ 'type' => 'integer',
+ ),
+ ),
+ ),'patch' => array(
+ 'path' => 'files/{fileId}/comments/{commentId}/replies/{replyId}',
+ 'httpMethod' => 'PATCH',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'commentId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'replyId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),'update' => array(
+ 'path' => 'files/{fileId}/comments/{commentId}/replies/{replyId}',
+ 'httpMethod' => 'PUT',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'commentId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'replyId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),
+ )
+ )
+ );
+ $this->revisions = new Google_Service_Drive_Revisions_Resource(
+ $this,
+ $this->serviceName,
+ 'revisions',
+ array(
+ 'methods' => array(
+ 'delete' => array(
+ 'path' => 'files/{fileId}/revisions/{revisionId}',
+ 'httpMethod' => 'DELETE',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'revisionId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),'get' => array(
+ 'path' => 'files/{fileId}/revisions/{revisionId}',
+ 'httpMethod' => 'GET',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'revisionId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),'list' => array(
+ 'path' => 'files/{fileId}/revisions',
+ 'httpMethod' => 'GET',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),'patch' => array(
+ 'path' => 'files/{fileId}/revisions/{revisionId}',
+ 'httpMethod' => 'PATCH',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'revisionId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),'update' => array(
+ 'path' => 'files/{fileId}/revisions/{revisionId}',
+ 'httpMethod' => 'PUT',
+ 'parameters' => array(
+ 'fileId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ 'revisionId' => array(
+ 'location' => 'path',
+ 'type' => 'string',
+ 'required' => true,
+ ),
+ ),
+ ),
+ )
+ )
+ );
+ }
+}
+
+
+/**
+ * The "about" collection of methods.
+ * Typical usage is:
+ * <code>
+ * $driveService = new Google_Service_Drive(...);
+ * $about = $driveService->about;
+ * </code>
+ */
+class Google_Service_Drive_About_Resource extends Google_Service_Resource
+{
+
+ /**
+ * Gets the information about the current user along with Drive API settings
+ * (about.get)
+ *
+ * @param array $optParams Optional parameters.
+ *
+ * @opt_param bool includeSubscribed
+ * When calculating the number of remaining change IDs, whether to include public files the user
+ * has opened and shared files. When set to false, this counts only change IDs for owned files and
+ * any shared or public files that the user has explicitly added to a folder they own.
+ * @opt_param string maxChangeIdCount
+ * Maximum number of remaining change IDs to count
+ * @opt_param string startChangeId
+ * Change ID to start counting from when calculating number of remaining change IDs
+ * @return Google_Service_Drive_About
+ */
+ public function get($optParams = array())
+ {
+ $params = array();
+ $params = array_merge($params, $optParams);
+ return $this->call('get', array($params), "Google_Service_Drive_About");
+ }
+}
+
+/**
+ * The "apps" collection of methods.
+ * Typical usage is:
+ * <code>
+ * $driveService = new Google_Service_Drive(...);
+ * $apps = $driveService->apps;
+ * </code>
+ */
+class Google_Service_Drive_Apps_Resource extends Google_Service_Resource
+{
+
+ /**
+ * Gets a specific app. (apps.get)
+ *
+ * @param string $appId
+ * The ID of the app.
+ * @param array $optParams Optional parameters.
+ * @return Google_Service_Drive_App
+ */
+ public function get($appId, $optParams = array())
+ {
+ $params = array('appId' => $appId);
+ $params = array_merge($params, $optParams);
+ return $this->call('get', array($params), "Google_Service_Drive_App");
+ }
+ /**
+ * Lists a user's installed apps. (apps.listApps)
+ *
+ * @param array $optParams Optional parameters.
+ *
+ * @opt_param string languageCode
+ * A language or locale code, as defined by BCP 47, with some extensions from Unicode's LDML format
+ * (http://www.unicode.org/reports/tr35/).
+ * @opt_param string appFilterExtensions
+ * A comma-separated list of file extensions for open with filtering. All apps within the given app
+ * query scope which can open any of the given file extensions will be included in the response. If
+ * appFilterMimeTypes are provided as well, the result is a union of the two resulting app lists.
+ * @opt_param string appFilterMimeTypes
+ * A comma-separated list of MIME types for open with filtering. All apps within the given app
+ * query scope which can open any of the given MIME types will be included in the response. If
+ * appFilterExtensions are provided as well, the result is a union of the two resulting app lists.
+ * @return Google_Service_Drive_AppList
+ */
+ public function listApps($optParams = array())
+ {
+ $params = array();
+ $params = array_merge($params, $optParams);
+ return $this->call('list', array($params), "Google_Service_Drive_AppList");
+ }
+}
+
+/**
+ * The "changes" collection of methods.
+ * Typical usage is:
+ * <code>
+ * $driveService = new Google_Service_Drive(...);
+ * $changes = $driveService->changes;
+ * </code>
+ */
+class Google_Service_Drive_Changes_Resource extends Google_Service_Resource
+{
+
+ /**
+ * Gets a specific change. (changes.get)
+ *
+ * @param string $changeId
+ * The ID of the change.
+ * @param array $optParams Optional parameters.
+ * @return Google_Service_Drive_Change
+ */
+ public function get($changeId, $optParams = array())
+ {
+ $params = array('changeId' => $changeId);
+ $params = array_merge($params, $optParams);
+ return $this->call('get', array($params), "Google_Service_Drive_Change");
+ }
+ /**
+ * Lists the changes for a user. (changes.listChanges)
+ *
+ * @param array $optParams Optional parameters.
+ *
+ * @opt_param bool includeSubscribed
+ * Whether to include public files the user has opened and shared files. When set to false, the
+ * list only includes owned files plus any shared or public files the user has explicitly added to
+ * a folder they own.
+ * @opt_param string startChangeId
+ * Change ID to start listing changes from.
+ * @opt_param bool includeDeleted
+ * Whether to include deleted items.
+ * @opt_param int maxResults
+ * Maximum number of changes to return.
+ * @opt_param string pageToken
+ * Page token for changes.
+ * @return Google_Service_Drive_ChangeList
+ */
+ public function listChanges($optParams = array())
+ {
+ $params = array();
+ $params = array_merge($params, $optParams);
+ return $this->call('list', array($params), "Google_Service_Drive_ChangeList");
+ }
+ /**
+ * Subscribe to changes for a user. (changes.watch)
+ *
+ * @param Google_Channel $postBody
+ * @param array $optParams Optional parameters.
+ *
+ * @opt_param bool includeSubscribed
+ * Whether to include public files the user has opened and shared files. When set to false, the
+ * list only includes owned files plus any shared or public files the user has explicitly added to
+ * a folder they own.
+ * @opt_param string startChangeId
+ * Change ID to start listing changes from.
+ * @opt_param bool includeDeleted
+ * Whether to include deleted items.
+ * @opt_param int maxResults
+ * Maximum number of changes to return.
+ * @opt_param string pageToken
+ * Page token for changes.
+ * @return Google_Service_Drive_Channel
+ */
+ public function watch(Google_Service_Drive_Channel $postBody, $optParams = array())
+ {
+ $params = array('postBody' => $postBody);
+ $params = array_merge($params, $optParams);
+ return $this->call('watch', array($params), "Google_Service_Drive_Channel");
+ }
+}
+
+/**
+ * The "channels" collection of methods.
+ * Typical usage is:
+ * <code>
+ * $driveService = new Google_Service_Drive(...);
+ * $channels = $driveService->channels;
+ * </code>
+ */
+class Google_Service_Drive_Channels_Resource extends Google_Service_Resource
+{
+
+ /**
+ * Stop watching resources through this channel (channels.stop)
+ *
+ * @param Google_Channel $postBody
+ * @param array $optParams Optional parameters.
+ */
+ public function stop(Google_Service_Drive_Channel $postBody, $optParams = array())
+ {
+ $params = array('postBody' => $postBody);
+ $params = array_merge($params, $optParams);
+ return $this->call('stop', array($params));
+ }
+}
+
+/**
+ * The "children" collection of methods.
+ * Typical usage is:
+ * <code>
+ * $driveService = new Google_Service_Drive(...);
+ * $children = $driveService->children;
+ * </code>
+ */
+class Google_Service_Drive_Children_Resource extends Google_Service_Resource
+{
+
+ /**
+ * Removes a child from a folder. (children.delete)
+ *
+ * @param string $folderId
+ * The ID of the folder.
+ * @param string $childId
+ * The ID of the child.
+ * @param array $optParams Optional parameters.
+ */
+ public function delete($folderId, $childId, $optParams = array())
+ {
+ $params = array('folderId' => $folderId, 'childId' => $childId);
+ $params = array_merge($params, $optParams);
+ return $this->call('delete', array($params));
+ }
+ /**
+ * Gets a specific child reference. (children.get)
+ *
+ * @param string $folderId
+ * The ID of the folder.
+ * @param string $childId
+ * The ID of the child.
+ * @param array $optParams Optional parameters.
+ * @return Google_Service_Drive_ChildReference
+ */
+ public function get($folderId, $childId, $optParams = array())
+ {
+ $params = array('folderId' => $folderId, 'childId' => $childId);
+ $params = array_merge($params, $optParams);
+ return $this->call('get', array($params), "Google_Service_Drive_ChildReference");
+ }
+ /**
+ * Inserts a file into a folder. (children.insert)
+ *
+ * @param string $folderId
+ * The ID of the folder.
+ * @param Google_ChildReference $postBody
+ * @param array $optParams Optional parameters.
+ * @return Google_Service_Drive_ChildReference
+ */
+ public function insert($folderId, Google_Service_Drive_ChildReference $postBody, $optParams = array())
+ {
+ $params = array('folderId' => $folderId, 'postBody' => $postBody);
+ $params = array_merge($params, $optParams);
+ return $this->call('insert', array($params), "Google_Service_Drive_ChildReference");
+ }
+ /**
+ * Lists a folder's children. (children.listChildren)
+ *
+ * @param string $folderId
+ * The ID of the folder.
+ * @param array $optParams Optional parameters.
+ *
+ * @opt_param string q
+ * Query string for searching children.
+ * @opt_param string pageToken
+ * Page token for children.
+ * @opt_param int maxResults
+ * Maximum number of children to return.
+ * @return Google_Service_Drive_ChildList
+ */
+ public function listChildren($folderId, $optParams = array())
+ {
+ $params = array('folderId' => $folderId);
+ $params = array_merge($params, $optParams);
+ return $this->call('list', array($params), "Google_Service_Drive_ChildList");
+ }
+}
+
+/**
+ * The "comments" collection of methods.
+ * Typical usage is:
+ * <code>
+ * $driveService = new Google_Service_Drive(...);
+ * $comments = $driveService->comments;
+ * </code>
+ */
+class Google_Service_Drive_Comments_Resource extends Google_Service_Resource
+{
+
+ /**
+ * Deletes a comment. (comments.delete)
+ *
+ * @param string $fileId
+ * The ID of the file.
+ * @param string $commentId
+ * The ID of the comment.
+ * @param array $optParams Optional parameters.
+ */
+ public function delete($fileId, $commentId, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'commentId' => $commentId);
+ $params = array_merge($params, $optParams);
+ return $this->call('delete', array($params));
+ }
+ /**
+ * Gets a comment by ID. (comments.get)
+ *
+ * @param string $fileId
+ * The ID of the file.
+ * @param string $commentId
+ * The ID of the comment.
+ * @param array $optParams Optional parameters.
+ *
+ * @opt_param bool includeDeleted
+ * If set, this will succeed when retrieving a deleted comment, and will include any deleted
+ * replies.
+ * @return Google_Service_Drive_Comment
+ */
+ public function get($fileId, $commentId, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'commentId' => $commentId);
+ $params = array_merge($params, $optParams);
+ return $this->call('get', array($params), "Google_Service_Drive_Comment");
+ }
+ /**
+ * Creates a new comment on the given file. (comments.insert)
+ *
+ * @param string $fileId
+ * The ID of the file.
+ * @param Google_Comment $postBody
+ * @param array $optParams Optional parameters.
+ * @return Google_Service_Drive_Comment
+ */
+ public function insert($fileId, Google_Service_Drive_Comment $postBody, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'postBody' => $postBody);
+ $params = array_merge($params, $optParams);
+ return $this->call('insert', array($params), "Google_Service_Drive_Comment");
+ }
+ /**
+ * Lists a file's comments. (comments.listComments)
+ *
+ * @param string $fileId
+ * The ID of the file.
+ * @param array $optParams Optional parameters.
+ *
+ * @opt_param string pageToken
+ * The continuation token, used to page through large result sets. To get the next page of results,
+ * set this parameter to the value of "nextPageToken" from the previous response.
+ * @opt_param string updatedMin
+ * Only discussions that were updated after this timestamp will be returned. Formatted as an RFC
+ * 3339 timestamp.
+ * @opt_param bool includeDeleted
+ * If set, all comments and replies, including deleted comments and replies (with content stripped)
+ * will be returned.
+ * @opt_param int maxResults
+ * The maximum number of discussions to include in the response, used for paging.
+ * @return Google_Service_Drive_CommentList
+ */
+ public function listComments($fileId, $optParams = array())
+ {
+ $params = array('fileId' => $fileId);
+ $params = array_merge($params, $optParams);
+ return $this->call('list', array($params), "Google_Service_Drive_CommentList");
+ }
+ /**
+ * Updates an existing comment. This method supports patch semantics.
+ * (comments.patch)
+ *
+ * @param string $fileId
+ * The ID of the file.
+ * @param string $commentId
+ * The ID of the comment.
+ * @param Google_Comment $postBody
+ * @param array $optParams Optional parameters.
+ * @return Google_Service_Drive_Comment
+ */
+ public function patch($fileId, $commentId, Google_Service_Drive_Comment $postBody, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'commentId' => $commentId, 'postBody' => $postBody);
+ $params = array_merge($params, $optParams);
+ return $this->call('patch', array($params), "Google_Service_Drive_Comment");
+ }
+ /**
+ * Updates an existing comment. (comments.update)
+ *
+ * @param string $fileId
+ * The ID of the file.
+ * @param string $commentId
+ * The ID of the comment.
+ * @param Google_Comment $postBody
+ * @param array $optParams Optional parameters.
+ * @return Google_Service_Drive_Comment
+ */
+ public function update($fileId, $commentId, Google_Service_Drive_Comment $postBody, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'commentId' => $commentId, 'postBody' => $postBody);
+ $params = array_merge($params, $optParams);
+ return $this->call('update', array($params), "Google_Service_Drive_Comment");
+ }
+}
+
+/**
+ * The "files" collection of methods.
+ * Typical usage is:
+ * <code>
+ * $driveService = new Google_Service_Drive(...);
+ * $files = $driveService->files;
+ * </code>
+ */
+class Google_Service_Drive_Files_Resource extends Google_Service_Resource
+{
+
+ /**
+ * Creates a copy of the specified file. (files.copy)
+ *
+ * @param string $fileId
+ * The ID of the file to copy.
+ * @param Google_DriveFile $postBody
+ * @param array $optParams Optional parameters.
+ *
+ * @opt_param bool convert
+ * Whether to convert this file to the corresponding Google Docs format.
+ * @opt_param string ocrLanguage
+ * If ocr is true, hints at the language to use. Valid values are ISO 639-1 codes.
+ * @opt_param string visibility
+ * The visibility of the new file. This parameter is only relevant when the source is not a native
+ * Google Doc and convert=false.
+ * @opt_param bool pinned
+ * Whether to pin the head revision of the new copy. A file can have a maximum of 200 pinned
+ * revisions.
+ * @opt_param bool ocr
+ * Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads.
+ * @opt_param string timedTextTrackName
+ * The timed text track name.
+ * @opt_param string timedTextLanguage
+ * The language of the timed text.
+ * @return Google_Service_Drive_DriveFile
+ */
+ public function copy($fileId, Google_Service_Drive_DriveFile $postBody, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'postBody' => $postBody);
+ $params = array_merge($params, $optParams);
+ return $this->call('copy', array($params), "Google_Service_Drive_DriveFile");
+ }
+ /**
+ * Permanently deletes a file by ID. Skips the trash. (files.delete)
+ *
+ * @param string $fileId
+ * The ID of the file to delete.
+ * @param array $optParams Optional parameters.
+ */
+ public function delete($fileId, $optParams = array())
+ {
+ $params = array('fileId' => $fileId);
+ $params = array_merge($params, $optParams);
+ return $this->call('delete', array($params));
+ }
+ /**
+ * Permanently deletes all of the user's trashed files. (files.emptyTrash)
+ *
+ * @param array $optParams Optional parameters.
+ */
+ public function emptyTrash($optParams = array())
+ {
+ $params = array();
+ $params = array_merge($params, $optParams);
+ return $this->call('emptyTrash', array($params));
+ }
+ /**
+ * Gets a file's metadata by ID. (files.get)
+ *
+ * @param string $fileId
+ * The ID for the file in question.
+ * @param array $optParams Optional parameters.
+ *
+ * @opt_param bool updateViewedDate
+ * Whether to update the view date after successfully retrieving the file.
+ * @opt_param string projection
+ * This parameter is deprecated and has no function.
+ * @return Google_Service_Drive_DriveFile
+ */
+ public function get($fileId, $optParams = array())
+ {
+ $params = array('fileId' => $fileId);
+ $params = array_merge($params, $optParams);
+ return $this->call('get', array($params), "Google_Service_Drive_DriveFile");
+ }
+ /**
+ * Insert a new file. (files.insert)
+ *
+ * @param Google_DriveFile $postBody
+ * @param array $optParams Optional parameters.
+ *
+ * @opt_param bool convert
+ * Whether to convert this file to the corresponding Google Docs format.
+ * @opt_param bool useContentAsIndexableText
+ * Whether to use the content as indexable text.
+ * @opt_param string ocrLanguage
+ * If ocr is true, hints at the language to use. Valid values are ISO 639-1 codes.
+ * @opt_param string visibility
+ * The visibility of the new file. This parameter is only relevant when convert=false.
+ * @opt_param bool pinned
+ * Whether to pin the head revision of the uploaded file. A file can have a maximum of 200 pinned
+ * revisions.
+ * @opt_param bool ocr
+ * Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads.
+ * @opt_param string timedTextTrackName
+ * The timed text track name.
+ * @opt_param string timedTextLanguage
+ * The language of the timed text.
+ * @return Google_Service_Drive_DriveFile
+ */
+ public function insert(Google_Service_Drive_DriveFile $postBody, $optParams = array())
+ {
+ $params = array('postBody' => $postBody);
+ $params = array_merge($params, $optParams);
+ return $this->call('insert', array($params), "Google_Service_Drive_DriveFile");
+ }
+ /**
+ * Lists the user's files. (files.listFiles)
+ *
+ * @param array $optParams Optional parameters.
+ *
+ * @opt_param string q
+ * Query string for searching files.
+ * @opt_param string pageToken
+ * Page token for files.
+ * @opt_param string corpus
+ * The body of items (files/documents) to which the query applies.
+ * @opt_param string projection
+ * This parameter is deprecated and has no function.
+ * @opt_param int maxResults
+ * Maximum number of files to return.
+ * @return Google_Service_Drive_FileList
+ */
+ public function listFiles($optParams = array())
+ {
+ $params = array();
+ $params = array_merge($params, $optParams);
+ return $this->call('list', array($params), "Google_Service_Drive_FileList");
+ }
+ /**
+ * Updates file metadata and/or content. This method supports patch semantics.
+ * (files.patch)
+ *
+ * @param string $fileId
+ * The ID of the file to update.
+ * @param Google_DriveFile $postBody
+ * @param array $optParams Optional parameters.
+ *
+ * @opt_param string addParents
+ * Comma-separated list of parent IDs to add.
+ * @opt_param bool updateViewedDate
+ * Whether to update the view date after successfully updating the file.
+ * @opt_param string removeParents
+ * Comma-separated list of parent IDs to remove.
+ * @opt_param bool setModifiedDate
+ * Whether to set the modified date with the supplied modified date.
+ * @opt_param bool convert
+ * Whether to convert this file to the corresponding Google Docs format.
+ * @opt_param bool useContentAsIndexableText
+ * Whether to use the content as indexable text.
+ * @opt_param string ocrLanguage
+ * If ocr is true, hints at the language to use. Valid values are ISO 639-1 codes.
+ * @opt_param bool pinned
+ * Whether to pin the new revision. A file can have a maximum of 200 pinned revisions.
+ * @opt_param bool newRevision
+ * Whether a blob upload should create a new revision. If false, the blob data in the current head
+ * revision is replaced. If true or not set, a new blob is created as head revision, and previous
+ * revisions are preserved (causing increased use of the user's data storage quota).
+ * @opt_param bool ocr
+ * Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads.
+ * @opt_param string timedTextLanguage
+ * The language of the timed text.
+ * @opt_param string timedTextTrackName
+ * The timed text track name.
+ * @return Google_Service_Drive_DriveFile
+ */
+ public function patch($fileId, Google_Service_Drive_DriveFile $postBody, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'postBody' => $postBody);
+ $params = array_merge($params, $optParams);
+ return $this->call('patch', array($params), "Google_Service_Drive_DriveFile");
+ }
+ /**
+ * Set the file's updated time to the current server time. (files.touch)
+ *
+ * @param string $fileId
+ * The ID of the file to update.
+ * @param array $optParams Optional parameters.
+ * @return Google_Service_Drive_DriveFile
+ */
+ public function touch($fileId, $optParams = array())
+ {
+ $params = array('fileId' => $fileId);
+ $params = array_merge($params, $optParams);
+ return $this->call('touch', array($params), "Google_Service_Drive_DriveFile");
+ }
+ /**
+ * Moves a file to the trash. (files.trash)
+ *
+ * @param string $fileId
+ * The ID of the file to trash.
+ * @param array $optParams Optional parameters.
+ * @return Google_Service_Drive_DriveFile
+ */
+ public function trash($fileId, $optParams = array())
+ {
+ $params = array('fileId' => $fileId);
+ $params = array_merge($params, $optParams);
+ return $this->call('trash', array($params), "Google_Service_Drive_DriveFile");
+ }
+ /**
+ * Restores a file from the trash. (files.untrash)
+ *
+ * @param string $fileId
+ * The ID of the file to untrash.
+ * @param array $optParams Optional parameters.
+ * @return Google_Service_Drive_DriveFile
+ */
+ public function untrash($fileId, $optParams = array())
+ {
+ $params = array('fileId' => $fileId);
+ $params = array_merge($params, $optParams);
+ return $this->call('untrash', array($params), "Google_Service_Drive_DriveFile");
+ }
+ /**
+ * Updates file metadata and/or content. (files.update)
+ *
+ * @param string $fileId
+ * The ID of the file to update.
+ * @param Google_DriveFile $postBody
+ * @param array $optParams Optional parameters.
+ *
+ * @opt_param string addParents
+ * Comma-separated list of parent IDs to add.
+ * @opt_param bool updateViewedDate
+ * Whether to update the view date after successfully updating the file.
+ * @opt_param string removeParents
+ * Comma-separated list of parent IDs to remove.
+ * @opt_param bool setModifiedDate
+ * Whether to set the modified date with the supplied modified date.
+ * @opt_param bool convert
+ * Whether to convert this file to the corresponding Google Docs format.
+ * @opt_param bool useContentAsIndexableText
+ * Whether to use the content as indexable text.
+ * @opt_param string ocrLanguage
+ * If ocr is true, hints at the language to use. Valid values are ISO 639-1 codes.
+ * @opt_param bool pinned
+ * Whether to pin the new revision. A file can have a maximum of 200 pinned revisions.
+ * @opt_param bool newRevision
+ * Whether a blob upload should create a new revision. If false, the blob data in the current head
+ * revision is replaced. If true or not set, a new blob is created as head revision, and previous
+ * revisions are preserved (causing increased use of the user's data storage quota).
+ * @opt_param bool ocr
+ * Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads.
+ * @opt_param string timedTextLanguage
+ * The language of the timed text.
+ * @opt_param string timedTextTrackName
+ * The timed text track name.
+ * @return Google_Service_Drive_DriveFile
+ */
+ public function update($fileId, Google_Service_Drive_DriveFile $postBody, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'postBody' => $postBody);
+ $params = array_merge($params, $optParams);
+ return $this->call('update', array($params), "Google_Service_Drive_DriveFile");
+ }
+ /**
+ * Subscribe to changes on a file (files.watch)
+ *
+ * @param string $fileId
+ * The ID for the file in question.
+ * @param Google_Channel $postBody
+ * @param array $optParams Optional parameters.
+ *
+ * @opt_param bool updateViewedDate
+ * Whether to update the view date after successfully retrieving the file.
+ * @opt_param string projection
+ * This parameter is deprecated and has no function.
+ * @return Google_Service_Drive_Channel
+ */
+ public function watch($fileId, Google_Service_Drive_Channel $postBody, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'postBody' => $postBody);
+ $params = array_merge($params, $optParams);
+ return $this->call('watch', array($params), "Google_Service_Drive_Channel");
+ }
+}
+
+/**
+ * The "parents" collection of methods.
+ * Typical usage is:
+ * <code>
+ * $driveService = new Google_Service_Drive(...);
+ * $parents = $driveService->parents;
+ * </code>
+ */
+class Google_Service_Drive_Parents_Resource extends Google_Service_Resource
+{
+
+ /**
+ * Removes a parent from a file. (parents.delete)
+ *
+ * @param string $fileId
+ * The ID of the file.
+ * @param string $parentId
+ * The ID of the parent.
+ * @param array $optParams Optional parameters.
+ */
+ public function delete($fileId, $parentId, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'parentId' => $parentId);
+ $params = array_merge($params, $optParams);
+ return $this->call('delete', array($params));
+ }
+ /**
+ * Gets a specific parent reference. (parents.get)
+ *
+ * @param string $fileId
+ * The ID of the file.
+ * @param string $parentId
+ * The ID of the parent.
+ * @param array $optParams Optional parameters.
+ * @return Google_Service_Drive_ParentReference
+ */
+ public function get($fileId, $parentId, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'parentId' => $parentId);
+ $params = array_merge($params, $optParams);
+ return $this->call('get', array($params), "Google_Service_Drive_ParentReference");
+ }
+ /**
+ * Adds a parent folder for a file. (parents.insert)
+ *
+ * @param string $fileId
+ * The ID of the file.
+ * @param Google_ParentReference $postBody
+ * @param array $optParams Optional parameters.
+ * @return Google_Service_Drive_ParentReference
+ */
+ public function insert($fileId, Google_Service_Drive_ParentReference $postBody, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'postBody' => $postBody);
+ $params = array_merge($params, $optParams);
+ return $this->call('insert', array($params), "Google_Service_Drive_ParentReference");
+ }
+ /**
+ * Lists a file's parents. (parents.listParents)
+ *
+ * @param string $fileId
+ * The ID of the file.
+ * @param array $optParams Optional parameters.
+ * @return Google_Service_Drive_ParentList
+ */
+ public function listParents($fileId, $optParams = array())
+ {
+ $params = array('fileId' => $fileId);
+ $params = array_merge($params, $optParams);
+ return $this->call('list', array($params), "Google_Service_Drive_ParentList");
+ }
+}
+
+/**
+ * The "permissions" collection of methods.
+ * Typical usage is:
+ * <code>
+ * $driveService = new Google_Service_Drive(...);
+ * $permissions = $driveService->permissions;
+ * </code>
+ */
+class Google_Service_Drive_Permissions_Resource extends Google_Service_Resource
+{
+
+ /**
+ * Deletes a permission from a file. (permissions.delete)
+ *
+ * @param string $fileId
+ * The ID for the file.
+ * @param string $permissionId
+ * The ID for the permission.
+ * @param array $optParams Optional parameters.
+ */
+ public function delete($fileId, $permissionId, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'permissionId' => $permissionId);
+ $params = array_merge($params, $optParams);
+ return $this->call('delete', array($params));
+ }
+ /**
+ * Gets a permission by ID. (permissions.get)
+ *
+ * @param string $fileId
+ * The ID for the file.
+ * @param string $permissionId
+ * The ID for the permission.
+ * @param array $optParams Optional parameters.
+ * @return Google_Service_Drive_Permission
+ */
+ public function get($fileId, $permissionId, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'permissionId' => $permissionId);
+ $params = array_merge($params, $optParams);
+ return $this->call('get', array($params), "Google_Service_Drive_Permission");
+ }
+ /**
+ * Returns the permission ID for an email address. (permissions.getIdForEmail)
+ *
+ * @param string $email
+ * The email address for which to return a permission ID
+ * @param array $optParams Optional parameters.
+ * @return Google_Service_Drive_PermissionId
+ */
+ public function getIdForEmail($email, $optParams = array())
+ {
+ $params = array('email' => $email);
+ $params = array_merge($params, $optParams);
+ return $this->call('getIdForEmail', array($params), "Google_Service_Drive_PermissionId");
+ }
+ /**
+ * Inserts a permission for a file. (permissions.insert)
+ *
+ * @param string $fileId
+ * The ID for the file.
+ * @param Google_Permission $postBody
+ * @param array $optParams Optional parameters.
+ *
+ * @opt_param string emailMessage
+ * A custom message to include in notification emails.
+ * @opt_param bool sendNotificationEmails
+ * Whether to send notification emails when sharing to users or groups. This parameter is ignored
+ * and an email is sent if the role is owner.
+ * @return Google_Service_Drive_Permission
+ */
+ public function insert($fileId, Google_Service_Drive_Permission $postBody, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'postBody' => $postBody);
+ $params = array_merge($params, $optParams);
+ return $this->call('insert', array($params), "Google_Service_Drive_Permission");
+ }
+ /**
+ * Lists a file's permissions. (permissions.listPermissions)
+ *
+ * @param string $fileId
+ * The ID for the file.
+ * @param array $optParams Optional parameters.
+ * @return Google_Service_Drive_PermissionList
+ */
+ public function listPermissions($fileId, $optParams = array())
+ {
+ $params = array('fileId' => $fileId);
+ $params = array_merge($params, $optParams);
+ return $this->call('list', array($params), "Google_Service_Drive_PermissionList");
+ }
+ /**
+ * Updates a permission. This method supports patch semantics.
+ * (permissions.patch)
+ *
+ * @param string $fileId
+ * The ID for the file.
+ * @param string $permissionId
+ * The ID for the permission.
+ * @param Google_Permission $postBody
+ * @param array $optParams Optional parameters.
+ *
+ * @opt_param bool transferOwnership
+ * Whether changing a role to 'owner' should also downgrade the current owners to writers.
+ * @return Google_Service_Drive_Permission
+ */
+ public function patch($fileId, $permissionId, Google_Service_Drive_Permission $postBody, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'permissionId' => $permissionId, 'postBody' => $postBody);
+ $params = array_merge($params, $optParams);
+ return $this->call('patch', array($params), "Google_Service_Drive_Permission");
+ }
+ /**
+ * Updates a permission. (permissions.update)
+ *
+ * @param string $fileId
+ * The ID for the file.
+ * @param string $permissionId
+ * The ID for the permission.
+ * @param Google_Permission $postBody
+ * @param array $optParams Optional parameters.
+ *
+ * @opt_param bool transferOwnership
+ * Whether changing a role to 'owner' should also downgrade the current owners to writers.
+ * @return Google_Service_Drive_Permission
+ */
+ public function update($fileId, $permissionId, Google_Service_Drive_Permission $postBody, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'permissionId' => $permissionId, 'postBody' => $postBody);
+ $params = array_merge($params, $optParams);
+ return $this->call('update', array($params), "Google_Service_Drive_Permission");
+ }
+}
+
+/**
+ * The "properties" collection of methods.
+ * Typical usage is:
+ * <code>
+ * $driveService = new Google_Service_Drive(...);
+ * $properties = $driveService->properties;
+ * </code>
+ */
+class Google_Service_Drive_Properties_Resource extends Google_Service_Resource
+{
+
+ /**
+ * Deletes a property. (properties.delete)
+ *
+ * @param string $fileId
+ * The ID of the file.
+ * @param string $propertyKey
+ * The key of the property.
+ * @param array $optParams Optional parameters.
+ *
+ * @opt_param string visibility
+ * The visibility of the property.
+ */
+ public function delete($fileId, $propertyKey, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'propertyKey' => $propertyKey);
+ $params = array_merge($params, $optParams);
+ return $this->call('delete', array($params));
+ }
+ /**
+ * Gets a property by its key. (properties.get)
+ *
+ * @param string $fileId
+ * The ID of the file.
+ * @param string $propertyKey
+ * The key of the property.
+ * @param array $optParams Optional parameters.
+ *
+ * @opt_param string visibility
+ * The visibility of the property.
+ * @return Google_Service_Drive_Property
+ */
+ public function get($fileId, $propertyKey, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'propertyKey' => $propertyKey);
+ $params = array_merge($params, $optParams);
+ return $this->call('get', array($params), "Google_Service_Drive_Property");
+ }
+ /**
+ * Adds a property to a file. (properties.insert)
+ *
+ * @param string $fileId
+ * The ID of the file.
+ * @param Google_Property $postBody
+ * @param array $optParams Optional parameters.
+ * @return Google_Service_Drive_Property
+ */
+ public function insert($fileId, Google_Service_Drive_Property $postBody, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'postBody' => $postBody);
+ $params = array_merge($params, $optParams);
+ return $this->call('insert', array($params), "Google_Service_Drive_Property");
+ }
+ /**
+ * Lists a file's properties. (properties.listProperties)
+ *
+ * @param string $fileId
+ * The ID of the file.
+ * @param array $optParams Optional parameters.
+ * @return Google_Service_Drive_PropertyList
+ */
+ public function listProperties($fileId, $optParams = array())
+ {
+ $params = array('fileId' => $fileId);
+ $params = array_merge($params, $optParams);
+ return $this->call('list', array($params), "Google_Service_Drive_PropertyList");
+ }
+ /**
+ * Updates a property. This method supports patch semantics. (properties.patch)
+ *
+ * @param string $fileId
+ * The ID of the file.
+ * @param string $propertyKey
+ * The key of the property.
+ * @param Google_Property $postBody
+ * @param array $optParams Optional parameters.
+ *
+ * @opt_param string visibility
+ * The visibility of the property.
+ * @return Google_Service_Drive_Property
+ */
+ public function patch($fileId, $propertyKey, Google_Service_Drive_Property $postBody, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'propertyKey' => $propertyKey, 'postBody' => $postBody);
+ $params = array_merge($params, $optParams);
+ return $this->call('patch', array($params), "Google_Service_Drive_Property");
+ }
+ /**
+ * Updates a property. (properties.update)
+ *
+ * @param string $fileId
+ * The ID of the file.
+ * @param string $propertyKey
+ * The key of the property.
+ * @param Google_Property $postBody
+ * @param array $optParams Optional parameters.
+ *
+ * @opt_param string visibility
+ * The visibility of the property.
+ * @return Google_Service_Drive_Property
+ */
+ public function update($fileId, $propertyKey, Google_Service_Drive_Property $postBody, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'propertyKey' => $propertyKey, 'postBody' => $postBody);
+ $params = array_merge($params, $optParams);
+ return $this->call('update', array($params), "Google_Service_Drive_Property");
+ }
+}
+
+/**
+ * The "realtime" collection of methods.
+ * Typical usage is:
+ * <code>
+ * $driveService = new Google_Service_Drive(...);
+ * $realtime = $driveService->realtime;
+ * </code>
+ */
+class Google_Service_Drive_Realtime_Resource extends Google_Service_Resource
+{
+
+ /**
+ * Exports the contents of the Realtime API data model associated with this file
+ * as JSON. (realtime.get)
+ *
+ * @param string $fileId
+ * The ID of the file that the Realtime API data model is associated with.
+ * @param array $optParams Optional parameters.
+ *
+ * @opt_param int revision
+ * The revision of the Realtime API data model to export. Revisions start at 1 (the initial empty
+ * data model) and are incremented with each change. If this parameter is excluded, the most recent
+ * data model will be returned.
+ */
+ public function get($fileId, $optParams = array())
+ {
+ $params = array('fileId' => $fileId);
+ $params = array_merge($params, $optParams);
+ return $this->call('get', array($params));
+ }
+ /**
+ * Overwrites the Realtime API data model associated with this file with the
+ * provided JSON data model. (realtime.update)
+ *
+ * @param string $fileId
+ * The ID of the file that the Realtime API data model is associated with.
+ * @param array $optParams Optional parameters.
+ *
+ * @opt_param string baseRevision
+ * The revision of the model to diff the uploaded model against. If set, the uploaded model is
+ * diffed against the provided revision and those differences are merged with any changes made to
+ * the model after the provided revision. If not set, the uploaded model replaces the current model
+ * on the server.
+ */
+ public function update($fileId, $optParams = array())
+ {
+ $params = array('fileId' => $fileId);
+ $params = array_merge($params, $optParams);
+ return $this->call('update', array($params));
+ }
+}
+
+/**
+ * The "replies" collection of methods.
+ * Typical usage is:
+ * <code>
+ * $driveService = new Google_Service_Drive(...);
+ * $replies = $driveService->replies;
+ * </code>
+ */
+class Google_Service_Drive_Replies_Resource extends Google_Service_Resource
+{
+
+ /**
+ * Deletes a reply. (replies.delete)
+ *
+ * @param string $fileId
+ * The ID of the file.
+ * @param string $commentId
+ * The ID of the comment.
+ * @param string $replyId
+ * The ID of the reply.
+ * @param array $optParams Optional parameters.
+ */
+ public function delete($fileId, $commentId, $replyId, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'commentId' => $commentId, 'replyId' => $replyId);
+ $params = array_merge($params, $optParams);
+ return $this->call('delete', array($params));
+ }
+ /**
+ * Gets a reply. (replies.get)
+ *
+ * @param string $fileId
+ * The ID of the file.
+ * @param string $commentId
+ * The ID of the comment.
+ * @param string $replyId
+ * The ID of the reply.
+ * @param array $optParams Optional parameters.
+ *
+ * @opt_param bool includeDeleted
+ * If set, this will succeed when retrieving a deleted reply.
+ * @return Google_Service_Drive_CommentReply
+ */
+ public function get($fileId, $commentId, $replyId, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'commentId' => $commentId, 'replyId' => $replyId);
+ $params = array_merge($params, $optParams);
+ return $this->call('get', array($params), "Google_Service_Drive_CommentReply");
+ }
+ /**
+ * Creates a new reply to the given comment. (replies.insert)
+ *
+ * @param string $fileId
+ * The ID of the file.
+ * @param string $commentId
+ * The ID of the comment.
+ * @param Google_CommentReply $postBody
+ * @param array $optParams Optional parameters.
+ * @return Google_Service_Drive_CommentReply
+ */
+ public function insert($fileId, $commentId, Google_Service_Drive_CommentReply $postBody, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'commentId' => $commentId, 'postBody' => $postBody);
+ $params = array_merge($params, $optParams);
+ return $this->call('insert', array($params), "Google_Service_Drive_CommentReply");
+ }
+ /**
+ * Lists all of the replies to a comment. (replies.listReplies)
+ *
+ * @param string $fileId
+ * The ID of the file.
+ * @param string $commentId
+ * The ID of the comment.
+ * @param array $optParams Optional parameters.
+ *
+ * @opt_param string pageToken
+ * The continuation token, used to page through large result sets. To get the next page of results,
+ * set this parameter to the value of "nextPageToken" from the previous response.
+ * @opt_param bool includeDeleted
+ * If set, all replies, including deleted replies (with content stripped) will be returned.
+ * @opt_param int maxResults
+ * The maximum number of replies to include in the response, used for paging.
+ * @return Google_Service_Drive_CommentReplyList
+ */
+ public function listReplies($fileId, $commentId, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'commentId' => $commentId);
+ $params = array_merge($params, $optParams);
+ return $this->call('list', array($params), "Google_Service_Drive_CommentReplyList");
+ }
+ /**
+ * Updates an existing reply. This method supports patch semantics.
+ * (replies.patch)
+ *
+ * @param string $fileId
+ * The ID of the file.
+ * @param string $commentId
+ * The ID of the comment.
+ * @param string $replyId
+ * The ID of the reply.
+ * @param Google_CommentReply $postBody
+ * @param array $optParams Optional parameters.
+ * @return Google_Service_Drive_CommentReply
+ */
+ public function patch($fileId, $commentId, $replyId, Google_Service_Drive_CommentReply $postBody, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'commentId' => $commentId, 'replyId' => $replyId, 'postBody' => $postBody);
+ $params = array_merge($params, $optParams);
+ return $this->call('patch', array($params), "Google_Service_Drive_CommentReply");
+ }
+ /**
+ * Updates an existing reply. (replies.update)
+ *
+ * @param string $fileId
+ * The ID of the file.
+ * @param string $commentId
+ * The ID of the comment.
+ * @param string $replyId
+ * The ID of the reply.
+ * @param Google_CommentReply $postBody
+ * @param array $optParams Optional parameters.
+ * @return Google_Service_Drive_CommentReply
+ */
+ public function update($fileId, $commentId, $replyId, Google_Service_Drive_CommentReply $postBody, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'commentId' => $commentId, 'replyId' => $replyId, 'postBody' => $postBody);
+ $params = array_merge($params, $optParams);
+ return $this->call('update', array($params), "Google_Service_Drive_CommentReply");
+ }
+}
+
+/**
+ * The "revisions" collection of methods.
+ * Typical usage is:
+ * <code>
+ * $driveService = new Google_Service_Drive(...);
+ * $revisions = $driveService->revisions;
+ * </code>
+ */
+class Google_Service_Drive_Revisions_Resource extends Google_Service_Resource
+{
+
+ /**
+ * Removes a revision. (revisions.delete)
+ *
+ * @param string $fileId
+ * The ID of the file.
+ * @param string $revisionId
+ * The ID of the revision.
+ * @param array $optParams Optional parameters.
+ */
+ public function delete($fileId, $revisionId, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'revisionId' => $revisionId);
+ $params = array_merge($params, $optParams);
+ return $this->call('delete', array($params));
+ }
+ /**
+ * Gets a specific revision. (revisions.get)
+ *
+ * @param string $fileId
+ * The ID of the file.
+ * @param string $revisionId
+ * The ID of the revision.
+ * @param array $optParams Optional parameters.
+ * @return Google_Service_Drive_Revision
+ */
+ public function get($fileId, $revisionId, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'revisionId' => $revisionId);
+ $params = array_merge($params, $optParams);
+ return $this->call('get', array($params), "Google_Service_Drive_Revision");
+ }
+ /**
+ * Lists a file's revisions. (revisions.listRevisions)
+ *
+ * @param string $fileId
+ * The ID of the file.
+ * @param array $optParams Optional parameters.
+ * @return Google_Service_Drive_RevisionList
+ */
+ public function listRevisions($fileId, $optParams = array())
+ {
+ $params = array('fileId' => $fileId);
+ $params = array_merge($params, $optParams);
+ return $this->call('list', array($params), "Google_Service_Drive_RevisionList");
+ }
+ /**
+ * Updates a revision. This method supports patch semantics. (revisions.patch)
+ *
+ * @param string $fileId
+ * The ID for the file.
+ * @param string $revisionId
+ * The ID for the revision.
+ * @param Google_Revision $postBody
+ * @param array $optParams Optional parameters.
+ * @return Google_Service_Drive_Revision
+ */
+ public function patch($fileId, $revisionId, Google_Service_Drive_Revision $postBody, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'revisionId' => $revisionId, 'postBody' => $postBody);
+ $params = array_merge($params, $optParams);
+ return $this->call('patch', array($params), "Google_Service_Drive_Revision");
+ }
+ /**
+ * Updates a revision. (revisions.update)
+ *
+ * @param string $fileId
+ * The ID for the file.
+ * @param string $revisionId
+ * The ID for the revision.
+ * @param Google_Revision $postBody
+ * @param array $optParams Optional parameters.
+ * @return Google_Service_Drive_Revision
+ */
+ public function update($fileId, $revisionId, Google_Service_Drive_Revision $postBody, $optParams = array())
+ {
+ $params = array('fileId' => $fileId, 'revisionId' => $revisionId, 'postBody' => $postBody);
+ $params = array_merge($params, $optParams);
+ return $this->call('update', array($params), "Google_Service_Drive_Revision");
+ }
+}
+
+
+
+
+class Google_Service_Drive_About extends Google_Collection
+{
+ protected $collection_key = 'quotaBytesByService';
+ protected $internal_gapi_mappings = array(
+ );
+ protected $additionalRoleInfoType = 'Google_Service_Drive_AboutAdditionalRoleInfo';
+ protected $additionalRoleInfoDataType = 'array';
+ public $domainSharingPolicy;
+ public $etag;
+ protected $exportFormatsType = 'Google_Service_Drive_AboutExportFormats';
+ protected $exportFormatsDataType = 'array';
+ protected $featuresType = 'Google_Service_Drive_AboutFeatures';
+ protected $featuresDataType = 'array';
+ protected $importFormatsType = 'Google_Service_Drive_AboutImportFormats';
+ protected $importFormatsDataType = 'array';
+ public $isCurrentAppInstalled;
+ public $kind;
+ public $languageCode;
+ public $largestChangeId;
+ protected $maxUploadSizesType = 'Google_Service_Drive_AboutMaxUploadSizes';
+ protected $maxUploadSizesDataType = 'array';
+ public $name;
+ public $permissionId;
+ protected $quotaBytesByServiceType = 'Google_Service_Drive_AboutQuotaBytesByService';
+ protected $quotaBytesByServiceDataType = 'array';
+ public $quotaBytesTotal;
+ public $quotaBytesUsed;
+ public $quotaBytesUsedAggregate;
+ public $quotaBytesUsedInTrash;
+ public $quotaType;
+ public $remainingChangeIds;
+ public $rootFolderId;
+ public $selfLink;
+ protected $userType = 'Google_Service_Drive_User';
+ protected $userDataType = '';
+
+ public function setAdditionalRoleInfo($additionalRoleInfo)
+ {
+ $this->additionalRoleInfo = $additionalRoleInfo;
+ }
+
+ public function getAdditionalRoleInfo()
+ {
+ return $this->additionalRoleInfo;
+ }
+
+ public function setDomainSharingPolicy($domainSharingPolicy)
+ {
+ $this->domainSharingPolicy = $domainSharingPolicy;
+ }
+
+ public function getDomainSharingPolicy()
+ {
+ return $this->domainSharingPolicy;
+ }
+
+ public function setEtag($etag)
+ {
+ $this->etag = $etag;
+ }
+
+ public function getEtag()
+ {
+ return $this->etag;
+ }
+
+ public function setExportFormats($exportFormats)
+ {
+ $this->exportFormats = $exportFormats;
+ }
+
+ public function getExportFormats()
+ {
+ return $this->exportFormats;
+ }
+
+ public function setFeatures($features)
+ {
+ $this->features = $features;
+ }
+
+ public function getFeatures()
+ {
+ return $this->features;
+ }
+
+ public function setImportFormats($importFormats)
+ {
+ $this->importFormats = $importFormats;
+ }
+
+ public function getImportFormats()
+ {
+ return $this->importFormats;
+ }
+
+ public function setIsCurrentAppInstalled($isCurrentAppInstalled)
+ {
+ $this->isCurrentAppInstalled = $isCurrentAppInstalled;
+ }
+
+ public function getIsCurrentAppInstalled()
+ {
+ return $this->isCurrentAppInstalled;
+ }
+
+ public function setKind($kind)
+ {
+ $this->kind = $kind;
+ }
+
+ public function getKind()
+ {
+ return $this->kind;
+ }
+
+ public function setLanguageCode($languageCode)
+ {
+ $this->languageCode = $languageCode;
+ }
+
+ public function getLanguageCode()
+ {
+ return $this->languageCode;
+ }
+
+ public function setLargestChangeId($largestChangeId)
+ {
+ $this->largestChangeId = $largestChangeId;
+ }
+
+ public function getLargestChangeId()
+ {
+ return $this->largestChangeId;
+ }
+
+ public function setMaxUploadSizes($maxUploadSizes)
+ {
+ $this->maxUploadSizes = $maxUploadSizes;
+ }
+
+ public function getMaxUploadSizes()
+ {
+ return $this->maxUploadSizes;
+ }
+
+ public function setName($name)
+ {
+ $this->name = $name;
+ }
+
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ public function setPermissionId($permissionId)
+ {
+ $this->permissionId = $permissionId;
+ }
+
+ public function getPermissionId()
+ {
+ return $this->permissionId;
+ }
+
+ public function setQuotaBytesByService($quotaBytesByService)
+ {
+ $this->quotaBytesByService = $quotaBytesByService;
+ }
+
+ public function getQuotaBytesByService()
+ {
+ return $this->quotaBytesByService;
+ }
+
+ public function setQuotaBytesTotal($quotaBytesTotal)
+ {
+ $this->quotaBytesTotal = $quotaBytesTotal;
+ }
+
+ public function getQuotaBytesTotal()
+ {
+ return $this->quotaBytesTotal;
+ }
+
+ public function setQuotaBytesUsed($quotaBytesUsed)
+ {
+ $this->quotaBytesUsed = $quotaBytesUsed;
+ }
+
+ public function getQuotaBytesUsed()
+ {
+ return $this->quotaBytesUsed;
+ }
+
+ public function setQuotaBytesUsedAggregate($quotaBytesUsedAggregate)
+ {
+ $this->quotaBytesUsedAggregate = $quotaBytesUsedAggregate;
+ }
+
+ public function getQuotaBytesUsedAggregate()
+ {
+ return $this->quotaBytesUsedAggregate;
+ }
+
+ public function setQuotaBytesUsedInTrash($quotaBytesUsedInTrash)
+ {
+ $this->quotaBytesUsedInTrash = $quotaBytesUsedInTrash;
+ }
+
+ public function getQuotaBytesUsedInTrash()
+ {
+ return $this->quotaBytesUsedInTrash;
+ }
+
+ public function setQuotaType($quotaType)
+ {
+ $this->quotaType = $quotaType;
+ }
+
+ public function getQuotaType()
+ {
+ return $this->quotaType;
+ }
+
+ public function setRemainingChangeIds($remainingChangeIds)
+ {
+ $this->remainingChangeIds = $remainingChangeIds;
+ }
+
+ public function getRemainingChangeIds()
+ {
+ return $this->remainingChangeIds;
+ }
+
+ public function setRootFolderId($rootFolderId)
+ {
+ $this->rootFolderId = $rootFolderId;
+ }
+
+ public function getRootFolderId()
+ {
+ return $this->rootFolderId;
+ }
+
+ public function setSelfLink($selfLink)
+ {
+ $this->selfLink = $selfLink;
+ }
+
+ public function getSelfLink()
+ {
+ return $this->selfLink;
+ }
+
+ public function setUser(Google_Service_Drive_User $user)
+ {
+ $this->user = $user;
+ }
+
+ public function getUser()
+ {
+ return $this->user;
+ }
+}
+
+class Google_Service_Drive_AboutAdditionalRoleInfo extends Google_Collection
+{
+ protected $collection_key = 'roleSets';
+ protected $internal_gapi_mappings = array(
+ );
+ protected $roleSetsType = 'Google_Service_Drive_AboutAdditionalRoleInfoRoleSets';
+ protected $roleSetsDataType = 'array';
+ public $type;
+
+ public function setRoleSets($roleSets)
+ {
+ $this->roleSets = $roleSets;
+ }
+
+ public function getRoleSets()
+ {
+ return $this->roleSets;
+ }
+
+ public function setType($type)
+ {
+ $this->type = $type;
+ }
+
+ public function getType()
+ {
+ return $this->type;
+ }
+}
+
+class Google_Service_Drive_AboutAdditionalRoleInfoRoleSets extends Google_Collection
+{
+ protected $collection_key = 'additionalRoles';
+ protected $internal_gapi_mappings = array(
+ );
+ public $additionalRoles;
+ public $primaryRole;
+
+ public function setAdditionalRoles($additionalRoles)
+ {
+ $this->additionalRoles = $additionalRoles;
+ }
+
+ public function getAdditionalRoles()
+ {
+ return $this->additionalRoles;
+ }
+
+ public function setPrimaryRole($primaryRole)
+ {
+ $this->primaryRole = $primaryRole;
+ }
+
+ public function getPrimaryRole()
+ {
+ return $this->primaryRole;
+ }
+}
+
+class Google_Service_Drive_AboutExportFormats extends Google_Collection
+{
+ protected $collection_key = 'targets';
+ protected $internal_gapi_mappings = array(
+ );
+ public $source;
+ public $targets;
+
+ public function setSource($source)
+ {
+ $this->source = $source;
+ }
+
+ public function getSource()
+ {
+ return $this->source;
+ }
+
+ public function setTargets($targets)
+ {
+ $this->targets = $targets;
+ }
+
+ public function getTargets()
+ {
+ return $this->targets;
+ }
+}
+
+class Google_Service_Drive_AboutFeatures extends Google_Model
+{
+ protected $internal_gapi_mappings = array(
+ );
+ public $featureName;
+ public $featureRate;
+
+ public function setFeatureName($featureName)
+ {
+ $this->featureName = $featureName;
+ }
+
+ public function getFeatureName()
+ {
+ return $this->featureName;
+ }
+
+ public function setFeatureRate($featureRate)
+ {
+ $this->featureRate = $featureRate;
+ }
+
+ public function getFeatureRate()
+ {
+ return $this->featureRate;
+ }
+}
+
+class Google_Service_Drive_AboutImportFormats extends Google_Collection
+{
+ protected $collection_key = 'targets';
+ protected $internal_gapi_mappings = array(
+ );
+ public $source;
+ public $targets;
+
+ public function setSource($source)
+ {
+ $this->source = $source;
+ }
+
+ public function getSource()
+ {
+ return $this->source;
+ }
+
+ public function setTargets($targets)
+ {
+ $this->targets = $targets;
+ }
+
+ public function getTargets()
+ {
+ return $this->targets;
+ }
+}
+
+class Google_Service_Drive_AboutMaxUploadSizes extends Google_Model
+{
+ protected $internal_gapi_mappings = array(
+ );
+ public $size;
+ public $type;
+
+ public function setSize($size)
+ {
+ $this->size = $size;
+ }
+
+ public function getSize()
+ {
+ return $this->size;
+ }
+
+ public function setType($type)
+ {
+ $this->type = $type;
+ }
+
+ public function getType()
+ {
+ return $this->type;
+ }
+}
+
+class Google_Service_Drive_AboutQuotaBytesByService extends Google_Model
+{
+ protected $internal_gapi_mappings = array(
+ );
+ public $bytesUsed;
+ public $serviceName;
+
+ public function setBytesUsed($bytesUsed)
+ {
+ $this->bytesUsed = $bytesUsed;
+ }
+
+ public function getBytesUsed()
+ {
+ return $this->bytesUsed;
+ }
+
+ public function setServiceName($serviceName)
+ {
+ $this->serviceName = $serviceName;
+ }
+
+ public function getServiceName()
+ {
+ return $this->serviceName;
+ }
+}
+
+class Google_Service_Drive_App extends Google_Collection
+{
+ protected $collection_key = 'secondaryMimeTypes';
+ protected $internal_gapi_mappings = array(
+ );
+ public $authorized;
+ public $createInFolderTemplate;
+ public $createUrl;
+ public $hasDriveWideScope;
+ protected $iconsType = 'Google_Service_Drive_AppIcons';
+ protected $iconsDataType = 'array';
+ public $id;
+ public $installed;
+ public $kind;
+ public $longDescription;
+ public $name;
+ public $objectType;
+ public $openUrlTemplate;
+ public $primaryFileExtensions;
+ public $primaryMimeTypes;
+ public $productId;
+ public $productUrl;
+ public $secondaryFileExtensions;
+ public $secondaryMimeTypes;
+ public $shortDescription;
+ public $supportsCreate;
+ public $supportsImport;
+ public $supportsMultiOpen;
+ public $supportsOfflineCreate;
+ public $useByDefault;
+
+ public function setAuthorized($authorized)
+ {
+ $this->authorized = $authorized;
+ }
+
+ public function getAuthorized()
+ {
+ return $this->authorized;
+ }
+
+ public function setCreateInFolderTemplate($createInFolderTemplate)
+ {
+ $this->createInFolderTemplate = $createInFolderTemplate;
+ }
+
+ public function getCreateInFolderTemplate()
+ {
+ return $this->createInFolderTemplate;
+ }
+
+ public function setCreateUrl($createUrl)
+ {
+ $this->createUrl = $createUrl;
+ }
+
+ public function getCreateUrl()
+ {
+ return $this->createUrl;
+ }
+
+ public function setHasDriveWideScope($hasDriveWideScope)
+ {
+ $this->hasDriveWideScope = $hasDriveWideScope;
+ }
+
+ public function getHasDriveWideScope()
+ {
+ return $this->hasDriveWideScope;
+ }
+
+ public function setIcons($icons)
+ {
+ $this->icons = $icons;
+ }
+
+ public function getIcons()
+ {
+ return $this->icons;
+ }
+
+ public function setId($id)
+ {
+ $this->id = $id;
+ }
+
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ public function setInstalled($installed)
+ {
+ $this->installed = $installed;
+ }
+
+ public function getInstalled()
+ {
+ return $this->installed;
+ }
+
+ public function setKind($kind)
+ {
+ $this->kind = $kind;
+ }
+
+ public function getKind()
+ {
+ return $this->kind;
+ }
+
+ public function setLongDescription($longDescription)
+ {
+ $this->longDescription = $longDescription;
+ }
+
+ public function getLongDescription()
+ {
+ return $this->longDescription;
+ }
+
+ public function setName($name)
+ {
+ $this->name = $name;
+ }
+
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ public function setObjectType($objectType)
+ {
+ $this->objectType = $objectType;
+ }
+
+ public function getObjectType()
+ {
+ return $this->objectType;
+ }
+
+ public function setOpenUrlTemplate($openUrlTemplate)
+ {
+ $this->openUrlTemplate = $openUrlTemplate;
+ }
+
+ public function getOpenUrlTemplate()
+ {
+ return $this->openUrlTemplate;
+ }
+
+ public function setPrimaryFileExtensions($primaryFileExtensions)
+ {
+ $this->primaryFileExtensions = $primaryFileExtensions;
+ }
+
+ public function getPrimaryFileExtensions()
+ {
+ return $this->primaryFileExtensions;
+ }
+
+ public function setPrimaryMimeTypes($primaryMimeTypes)
+ {
+ $this->primaryMimeTypes = $primaryMimeTypes;
+ }
+
+ public function getPrimaryMimeTypes()
+ {
+ return $this->primaryMimeTypes;
+ }
+
+ public function setProductId($productId)
+ {
+ $this->productId = $productId;
+ }
+
+ public function getProductId()
+ {
+ return $this->productId;
+ }
+
+ public function setProductUrl($productUrl)
+ {
+ $this->productUrl = $productUrl;
+ }
+
+ public function getProductUrl()
+ {
+ return $this->productUrl;
+ }
+
+ public function setSecondaryFileExtensions($secondaryFileExtensions)
+ {
+ $this->secondaryFileExtensions = $secondaryFileExtensions;
+ }
+
+ public function getSecondaryFileExtensions()
+ {
+ return $this->secondaryFileExtensions;
+ }
+
+ public function setSecondaryMimeTypes($secondaryMimeTypes)
+ {
+ $this->secondaryMimeTypes = $secondaryMimeTypes;
+ }
+
+ public function getSecondaryMimeTypes()
+ {
+ return $this->secondaryMimeTypes;
+ }
+
+ public function setShortDescription($shortDescription)
+ {
+ $this->shortDescription = $shortDescription;
+ }
+
+ public function getShortDescription()
+ {
+ return $this->shortDescription;
+ }
+
+ public function setSupportsCreate($supportsCreate)
+ {
+ $this->supportsCreate = $supportsCreate;
+ }
+
+ public function getSupportsCreate()
+ {
+ return $this->supportsCreate;
+ }
+
+ public function setSupportsImport($supportsImport)
+ {
+ $this->supportsImport = $supportsImport;
+ }
+
+ public function getSupportsImport()
+ {
+ return $this->supportsImport;
+ }
+
+ public function setSupportsMultiOpen($supportsMultiOpen)
+ {
+ $this->supportsMultiOpen = $supportsMultiOpen;
+ }
+
+ public function getSupportsMultiOpen()
+ {
+ return $this->supportsMultiOpen;
+ }
+
+ public function setSupportsOfflineCreate($supportsOfflineCreate)
+ {
+ $this->supportsOfflineCreate = $supportsOfflineCreate;
+ }
+
+ public function getSupportsOfflineCreate()
+ {
+ return $this->supportsOfflineCreate;
+ }
+
+ public function setUseByDefault($useByDefault)
+ {
+ $this->useByDefault = $useByDefault;
+ }
+
+ public function getUseByDefault()
+ {
+ return $this->useByDefault;
+ }
+}
+
+class Google_Service_Drive_AppIcons extends Google_Model
+{
+ protected $internal_gapi_mappings = array(
+ );
+ public $category;
+ public $iconUrl;
+ public $size;
+
+ public function setCategory($category)
+ {
+ $this->category = $category;
+ }
+
+ public function getCategory()
+ {
+ return $this->category;
+ }
+
+ public function setIconUrl($iconUrl)
+ {
+ $this->iconUrl = $iconUrl;
+ }
+
+ public function getIconUrl()
+ {
+ return $this->iconUrl;
+ }
+
+ public function setSize($size)
+ {
+ $this->size = $size;
+ }
+
+ public function getSize()
+ {
+ return $this->size;
+ }
+}
+
+class Google_Service_Drive_AppList extends Google_Collection
+{
+ protected $collection_key = 'items';
+ protected $internal_gapi_mappings = array(
+ );
+ public $defaultAppIds;
+ public $etag;
+ protected $itemsType = 'Google_Service_Drive_App';
+ protected $itemsDataType = 'array';
+ public $kind;
+ public $selfLink;
+
+ public function setDefaultAppIds($defaultAppIds)
+ {
+ $this->defaultAppIds = $defaultAppIds;
+ }
+
+ public function getDefaultAppIds()
+ {
+ return $this->defaultAppIds;
+ }
+
+ public function setEtag($etag)
+ {
+ $this->etag = $etag;
+ }
+
+ public function getEtag()
+ {
+ return $this->etag;
+ }
+
+ public function setItems($items)
+ {
+ $this->items = $items;
+ }
+
+ public function getItems()
+ {
+ return $this->items;
+ }
+
+ public function setKind($kind)
+ {
+ $this->kind = $kind;
+ }
+
+ public function getKind()
+ {
+ return $this->kind;
+ }
+
+ public function setSelfLink($selfLink)
+ {
+ $this->selfLink = $selfLink;
+ }
+
+ public function getSelfLink()
+ {
+ return $this->selfLink;
+ }
+}
+
+class Google_Service_Drive_Change extends Google_Model
+{
+ protected $internal_gapi_mappings = array(
+ );
+ public $deleted;
+ protected $fileType = 'Google_Service_Drive_DriveFile';
+ protected $fileDataType = '';
+ public $fileId;
+ public $id;
+ public $kind;
+ public $modificationDate;
+ public $selfLink;
+
+ public function setDeleted($deleted)
+ {
+ $this->deleted = $deleted;
+ }
+
+ public function getDeleted()
+ {
+ return $this->deleted;
+ }
+
+ public function setFile(Google_Service_Drive_DriveFile $file)
+ {
+ $this->file = $file;
+ }
+
+ public function getFile()
+ {
+ return $this->file;
+ }
+
+ public function setFileId($fileId)
+ {
+ $this->fileId = $fileId;
+ }
+
+ public function getFileId()
+ {
+ return $this->fileId;
+ }
+
+ public function setId($id)
+ {
+ $this->id = $id;
+ }
+
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ public function setKind($kind)
+ {
+ $this->kind = $kind;
+ }
+
+ public function getKind()
+ {
+ return $this->kind;
+ }
+
+ public function setModificationDate($modificationDate)
+ {
+ $this->modificationDate = $modificationDate;
+ }
+
+ public function getModificationDate()
+ {
+ return $this->modificationDate;
+ }
+
+ public function setSelfLink($selfLink)
+ {
+ $this->selfLink = $selfLink;
+ }
+
+ public function getSelfLink()
+ {
+ return $this->selfLink;
+ }
+}
+
+class Google_Service_Drive_ChangeList extends Google_Collection
+{
+ protected $collection_key = 'items';
+ protected $internal_gapi_mappings = array(
+ );
+ public $etag;
+ protected $itemsType = 'Google_Service_Drive_Change';
+ protected $itemsDataType = 'array';
+ public $kind;
+ public $largestChangeId;
+ public $nextLink;
+ public $nextPageToken;
+ public $selfLink;
+
+ public function setEtag($etag)
+ {
+ $this->etag = $etag;
+ }
+
+ public function getEtag()
+ {
+ return $this->etag;
+ }
+
+ public function setItems($items)
+ {
+ $this->items = $items;
+ }
+
+ public function getItems()
+ {
+ return $this->items;
+ }
+
+ public function setKind($kind)
+ {
+ $this->kind = $kind;
+ }
+
+ public function getKind()
+ {
+ return $this->kind;
+ }
+
+ public function setLargestChangeId($largestChangeId)
+ {
+ $this->largestChangeId = $largestChangeId;
+ }
+
+ public function getLargestChangeId()
+ {
+ return $this->largestChangeId;
+ }
+
+ public function setNextLink($nextLink)
+ {
+ $this->nextLink = $nextLink;
+ }
+
+ public function getNextLink()
+ {
+ return $this->nextLink;
+ }
+
+ public function setNextPageToken($nextPageToken)
+ {
+ $this->nextPageToken = $nextPageToken;
+ }
+
+ public function getNextPageToken()
+ {
+ return $this->nextPageToken;
+ }
+
+ public function setSelfLink($selfLink)
+ {
+ $this->selfLink = $selfLink;
+ }
+
+ public function getSelfLink()
+ {
+ return $this->selfLink;
+ }
+}
+
+class Google_Service_Drive_Channel extends Google_Model
+{
+ protected $internal_gapi_mappings = array(
+ );
+ public $address;
+ public $expiration;
+ public $id;
+ public $kind;
+ public $params;
+ public $payload;
+ public $resourceId;
+ public $resourceUri;
+ public $token;
+ public $type;
+
+ public function setAddress($address)
+ {
+ $this->address = $address;
+ }
+
+ public function getAddress()
+ {
+ return $this->address;
+ }
+
+ public function setExpiration($expiration)
+ {
+ $this->expiration = $expiration;
+ }
+
+ public function getExpiration()
+ {
+ return $this->expiration;
+ }
+
+ public function setId($id)
+ {
+ $this->id = $id;
+ }
+
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ public function setKind($kind)
+ {
+ $this->kind = $kind;
+ }
+
+ public function getKind()
+ {
+ return $this->kind;
+ }
+
+ public function setParams($params)
+ {
+ $this->params = $params;
+ }
+
+ public function getParams()
+ {
+ return $this->params;
+ }
+
+ public function setPayload($payload)
+ {
+ $this->payload = $payload;
+ }
+
+ public function getPayload()
+ {
+ return $this->payload;
+ }
+
+ public function setResourceId($resourceId)
+ {
+ $this->resourceId = $resourceId;
+ }
+
+ public function getResourceId()
+ {
+ return $this->resourceId;
+ }
+
+ public function setResourceUri($resourceUri)
+ {
+ $this->resourceUri = $resourceUri;
+ }
+
+ public function getResourceUri()
+ {
+ return $this->resourceUri;
+ }
+
+ public function setToken($token)
+ {
+ $this->token = $token;
+ }
+
+ public function getToken()
+ {
+ return $this->token;
+ }
+
+ public function setType($type)
+ {
+ $this->type = $type;
+ }
+
+ public function getType()
+ {
+ return $this->type;
+ }
+}
+
+class Google_Service_Drive_ChannelParams extends Google_Model
+{
+ protected $internal_gapi_mappings = array(
+ );
+}
+
+class Google_Service_Drive_ChildList extends Google_Collection
+{
+ protected $collection_key = 'items';
+ protected $internal_gapi_mappings = array(
+ );
+ public $etag;
+ protected $itemsType = 'Google_Service_Drive_ChildReference';
+ protected $itemsDataType = 'array';
+ public $kind;
+ public $nextLink;
+ public $nextPageToken;
+ public $selfLink;
+
+ public function setEtag($etag)
+ {
+ $this->etag = $etag;
+ }
+
+ public function getEtag()
+ {
+ return $this->etag;
+ }
+
+ public function setItems($items)
+ {
+ $this->items = $items;
+ }
+
+ public function getItems()
+ {
+ return $this->items;
+ }
+
+ public function setKind($kind)
+ {
+ $this->kind = $kind;
+ }
+
+ public function getKind()
+ {
+ return $this->kind;
+ }
+
+ public function setNextLink($nextLink)
+ {
+ $this->nextLink = $nextLink;
+ }
+
+ public function getNextLink()
+ {
+ return $this->nextLink;
+ }
+
+ public function setNextPageToken($nextPageToken)
+ {
+ $this->nextPageToken = $nextPageToken;
+ }
+
+ public function getNextPageToken()
+ {
+ return $this->nextPageToken;
+ }
+
+ public function setSelfLink($selfLink)
+ {
+ $this->selfLink = $selfLink;
+ }
+
+ public function getSelfLink()
+ {
+ return $this->selfLink;
+ }
+}
+
+class Google_Service_Drive_ChildReference extends Google_Model
+{
+ protected $internal_gapi_mappings = array(
+ );
+ public $childLink;
+ public $id;
+ public $kind;
+ public $selfLink;
+
+ public function setChildLink($childLink)
+ {
+ $this->childLink = $childLink;
+ }
+
+ public function getChildLink()
+ {
+ return $this->childLink;
+ }
+
+ public function setId($id)
+ {
+ $this->id = $id;
+ }
+
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ public function setKind($kind)
+ {
+ $this->kind = $kind;
+ }
+
+ public function getKind()
+ {
+ return $this->kind;
+ }
+
+ public function setSelfLink($selfLink)
+ {
+ $this->selfLink = $selfLink;
+ }
+
+ public function getSelfLink()
+ {
+ return $this->selfLink;
+ }
+}
+
+class Google_Service_Drive_Comment extends Google_Collection
+{
+ protected $collection_key = 'replies';
+ protected $internal_gapi_mappings = array(
+ );
+ public $anchor;
+ protected $authorType = 'Google_Service_Drive_User';
+ protected $authorDataType = '';
+ public $commentId;
+ public $content;
+ protected $contextType = 'Google_Service_Drive_CommentContext';
+ protected $contextDataType = '';
+ public $createdDate;
+ public $deleted;
+ public $fileId;
+ public $fileTitle;
+ public $htmlContent;
+ public $kind;
+ public $modifiedDate;
+ protected $repliesType = 'Google_Service_Drive_CommentReply';
+ protected $repliesDataType = 'array';
+ public $selfLink;
+ public $status;
+
+ public function setAnchor($anchor)
+ {
+ $this->anchor = $anchor;
+ }
+
+ public function getAnchor()
+ {
+ return $this->anchor;
+ }
+
+ public function setAuthor(Google_Service_Drive_User $author)
+ {
+ $this->author = $author;
+ }
+
+ public function getAuthor()
+ {
+ return $this->author;
+ }
+
+ public function setCommentId($commentId)
+ {
+ $this->commentId = $commentId;
+ }
+
+ public function getCommentId()
+ {
+ return $this->commentId;
+ }
+
+ public function setContent($content)
+ {
+ $this->content = $content;
+ }
+
+ public function getContent()
+ {
+ return $this->content;
+ }
+
+ public function setContext(Google_Service_Drive_CommentContext $context)
+ {
+ $this->context = $context;
+ }
+
+ public function getContext()
+ {
+ return $this->context;
+ }
+
+ public function setCreatedDate($createdDate)
+ {
+ $this->createdDate = $createdDate;
+ }
+
+ public function getCreatedDate()
+ {
+ return $this->createdDate;
+ }
+
+ public function setDeleted($deleted)
+ {
+ $this->deleted = $deleted;
+ }
+
+ public function getDeleted()
+ {
+ return $this->deleted;
+ }
+
+ public function setFileId($fileId)
+ {
+ $this->fileId = $fileId;
+ }
+
+ public function getFileId()
+ {
+ return $this->fileId;
+ }
+
+ public function setFileTitle($fileTitle)
+ {
+ $this->fileTitle = $fileTitle;
+ }
+
+ public function getFileTitle()
+ {
+ return $this->fileTitle;
+ }
+
+ public function setHtmlContent($htmlContent)
+ {
+ $this->htmlContent = $htmlContent;
+ }
+
+ public function getHtmlContent()
+ {
+ return $this->htmlContent;
+ }
+
+ public function setKind($kind)
+ {
+ $this->kind = $kind;
+ }
+
+ public function getKind()
+ {
+ return $this->kind;
+ }
+
+ public function setModifiedDate($modifiedDate)
+ {
+ $this->modifiedDate = $modifiedDate;
+ }
+
+ public function getModifiedDate()
+ {
+ return $this->modifiedDate;
+ }
+
+ public function setReplies($replies)
+ {
+ $this->replies = $replies;
+ }
+
+ public function getReplies()
+ {
+ return $this->replies;
+ }
+
+ public function setSelfLink($selfLink)
+ {
+ $this->selfLink = $selfLink;
+ }
+
+ public function getSelfLink()
+ {
+ return $this->selfLink;
+ }
+
+ public function setStatus($status)
+ {
+ $this->status = $status;
+ }
+
+ public function getStatus()
+ {
+ return $this->status;
+ }
+}
+
+class Google_Service_Drive_CommentContext extends Google_Model
+{
+ protected $internal_gapi_mappings = array(
+ );
+ public $type;
+ public $value;
+
+ public function setType($type)
+ {
+ $this->type = $type;
+ }
+
+ public function getType()
+ {
+ return $this->type;
+ }
+
+ public function setValue($value)
+ {
+ $this->value = $value;
+ }
+
+ public function getValue()
+ {
+ return $this->value;
+ }
+}
+
+class Google_Service_Drive_CommentList extends Google_Collection
+{
+ protected $collection_key = 'items';
+ protected $internal_gapi_mappings = array(
+ );
+ protected $itemsType = 'Google_Service_Drive_Comment';
+ protected $itemsDataType = 'array';
+ public $kind;
+ public $nextLink;
+ public $nextPageToken;
+ public $selfLink;
+
+ public function setItems($items)
+ {
+ $this->items = $items;
+ }
+
+ public function getItems()
+ {
+ return $this->items;
+ }
+
+ public function setKind($kind)
+ {
+ $this->kind = $kind;
+ }
+
+ public function getKind()
+ {
+ return $this->kind;
+ }
+
+ public function setNextLink($nextLink)
+ {
+ $this->nextLink = $nextLink;
+ }
+
+ public function getNextLink()
+ {
+ return $this->nextLink;
+ }
+
+ public function setNextPageToken($nextPageToken)
+ {
+ $this->nextPageToken = $nextPageToken;
+ }
+
+ public function getNextPageToken()
+ {
+ return $this->nextPageToken;
+ }
+
+ public function setSelfLink($selfLink)
+ {
+ $this->selfLink = $selfLink;
+ }
+
+ public function getSelfLink()
+ {
+ return $this->selfLink;
+ }
+}
+
+class Google_Service_Drive_CommentReply extends Google_Model
+{
+ protected $internal_gapi_mappings = array(
+ );
+ protected $authorType = 'Google_Service_Drive_User';
+ protected $authorDataType = '';
+ public $content;
+ public $createdDate;
+ public $deleted;
+ public $htmlContent;
+ public $kind;
+ public $modifiedDate;
+ public $replyId;
+ public $verb;
+
+ public function setAuthor(Google_Service_Drive_User $author)
+ {
+ $this->author = $author;
+ }
+
+ public function getAuthor()
+ {
+ return $this->author;
+ }
+
+ public function setContent($content)
+ {
+ $this->content = $content;
+ }
+
+ public function getContent()
+ {
+ return $this->content;
+ }
+
+ public function setCreatedDate($createdDate)
+ {
+ $this->createdDate = $createdDate;
+ }
+
+ public function getCreatedDate()
+ {
+ return $this->createdDate;
+ }
+
+ public function setDeleted($deleted)
+ {
+ $this->deleted = $deleted;
+ }
+
+ public function getDeleted()
+ {
+ return $this->deleted;
+ }
+
+ public function setHtmlContent($htmlContent)
+ {
+ $this->htmlContent = $htmlContent;
+ }
+
+ public function getHtmlContent()
+ {
+ return $this->htmlContent;
+ }
+
+ public function setKind($kind)
+ {
+ $this->kind = $kind;
+ }
+
+ public function getKind()
+ {
+ return $this->kind;
+ }
+
+ public function setModifiedDate($modifiedDate)
+ {
+ $this->modifiedDate = $modifiedDate;
+ }
+
+ public function getModifiedDate()
+ {
+ return $this->modifiedDate;
+ }
+
+ public function setReplyId($replyId)
+ {
+ $this->replyId = $replyId;
+ }
+
+ public function getReplyId()
+ {
+ return $this->replyId;
+ }
+
+ public function setVerb($verb)
+ {
+ $this->verb = $verb;
+ }
+
+ public function getVerb()
+ {
+ return $this->verb;
+ }
+}
+
+class Google_Service_Drive_CommentReplyList extends Google_Collection
+{
+ protected $collection_key = 'items';
+ protected $internal_gapi_mappings = array(
+ );
+ protected $itemsType = 'Google_Service_Drive_CommentReply';
+ protected $itemsDataType = 'array';
+ public $kind;
+ public $nextLink;
+ public $nextPageToken;
+ public $selfLink;
+
+ public function setItems($items)
+ {
+ $this->items = $items;
+ }
+
+ public function getItems()
+ {
+ return $this->items;
+ }
+
+ public function setKind($kind)
+ {
+ $this->kind = $kind;
+ }
+
+ public function getKind()
+ {
+ return $this->kind;
+ }
+
+ public function setNextLink($nextLink)
+ {
+ $this->nextLink = $nextLink;
+ }
+
+ public function getNextLink()
+ {
+ return $this->nextLink;
+ }
+
+ public function setNextPageToken($nextPageToken)
+ {
+ $this->nextPageToken = $nextPageToken;
+ }
+
+ public function getNextPageToken()
+ {
+ return $this->nextPageToken;
+ }
+
+ public function setSelfLink($selfLink)
+ {
+ $this->selfLink = $selfLink;
+ }
+
+ public function getSelfLink()
+ {
+ return $this->selfLink;
+ }
+}
+
+class Google_Service_Drive_DriveFile extends Google_Collection
+{
+ protected $collection_key = 'properties';
+ protected $internal_gapi_mappings = array(
+ );
+ public $alternateLink;
+ public $appDataContents;
+ public $copyable;
+ public $createdDate;
+ public $defaultOpenWithLink;
+ public $description;
+ public $downloadUrl;
+ public $editable;
+ public $embedLink;
+ public $etag;
+ public $explicitlyTrashed;
+ public $exportLinks;
+ public $fileExtension;
+ public $fileSize;
+ public $headRevisionId;
+ public $iconLink;
+ public $id;
+ protected $imageMediaMetadataType = 'Google_Service_Drive_DriveFileImageMediaMetadata';
+ protected $imageMediaMetadataDataType = '';
+ protected $indexableTextType = 'Google_Service_Drive_DriveFileIndexableText';
+ protected $indexableTextDataType = '';
+ public $kind;
+ protected $labelsType = 'Google_Service_Drive_DriveFileLabels';
+ protected $labelsDataType = '';
+ protected $lastModifyingUserType = 'Google_Service_Drive_User';
+ protected $lastModifyingUserDataType = '';
+ public $lastModifyingUserName;
+ public $lastViewedByMeDate;
+ public $markedViewedByMeDate;
+ public $md5Checksum;
+ public $mimeType;
+ public $modifiedByMeDate;
+ public $modifiedDate;
+ public $openWithLinks;
+ public $originalFilename;
+ public $ownerNames;
+ protected $ownersType = 'Google_Service_Drive_User';
+ protected $ownersDataType = 'array';
+ protected $parentsType = 'Google_Service_Drive_ParentReference';
+ protected $parentsDataType = 'array';
+ protected $permissionsType = 'Google_Service_Drive_Permission';
+ protected $permissionsDataType = 'array';
+ protected $propertiesType = 'Google_Service_Drive_Property';
+ protected $propertiesDataType = 'array';
+ public $quotaBytesUsed;
+ public $selfLink;
+ public $shared;
+ public $sharedWithMeDate;
+ protected $sharingUserType = 'Google_Service_Drive_User';
+ protected $sharingUserDataType = '';
+ protected $thumbnailType = 'Google_Service_Drive_DriveFileThumbnail';
+ protected $thumbnailDataType = '';
+ public $thumbnailLink;
+ public $title;
+ protected $userPermissionType = 'Google_Service_Drive_Permission';
+ protected $userPermissionDataType = '';
+ public $version;
+ protected $videoMediaMetadataType = 'Google_Service_Drive_DriveFileVideoMediaMetadata';
+ protected $videoMediaMetadataDataType = '';
+ public $webContentLink;
+ public $webViewLink;
+ public $writersCanShare;
+
+ public function setAlternateLink($alternateLink)
+ {
+ $this->alternateLink = $alternateLink;
+ }
+
+ public function getAlternateLink()
+ {
+ return $this->alternateLink;
+ }
+
+ public function setAppDataContents($appDataContents)
+ {
+ $this->appDataContents = $appDataContents;
+ }
+
+ public function getAppDataContents()
+ {
+ return $this->appDataContents;
+ }
+
+ public function setCopyable($copyable)
+ {
+ $this->copyable = $copyable;
+ }
+
+ public function getCopyable()
+ {
+ return $this->copyable;
+ }
+
+ public function setCreatedDate($createdDate)
+ {
+ $this->createdDate = $createdDate;
+ }
+
+ public function getCreatedDate()
+ {
+ return $this->createdDate;
+ }
+
+ public function setDefaultOpenWithLink($defaultOpenWithLink)
+ {
+ $this->defaultOpenWithLink = $defaultOpenWithLink;
+ }
+
+ public function getDefaultOpenWithLink()
+ {
+ return $this->defaultOpenWithLink;
+ }
+
+ public function setDescription($description)
+ {
+ $this->description = $description;
+ }
+
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ public function setDownloadUrl($downloadUrl)
+ {
+ $this->downloadUrl = $downloadUrl;
+ }
+
+ public function getDownloadUrl()
+ {
+ return $this->downloadUrl;
+ }
+
+ public function setEditable($editable)
+ {
+ $this->editable = $editable;
+ }
+
+ public function getEditable()
+ {
+ return $this->editable;
+ }
+
+ public function setEmbedLink($embedLink)
+ {
+ $this->embedLink = $embedLink;
+ }
+
+ public function getEmbedLink()
+ {
+ return $this->embedLink;
+ }
+
+ public function setEtag($etag)
+ {
+ $this->etag = $etag;
+ }
+
+ public function getEtag()
+ {
+ return $this->etag;
+ }
+
+ public function setExplicitlyTrashed($explicitlyTrashed)
+ {
+ $this->explicitlyTrashed = $explicitlyTrashed;
+ }
+
+ public function getExplicitlyTrashed()
+ {
+ return $this->explicitlyTrashed;
+ }
+
+ public function setExportLinks($exportLinks)
+ {
+ $this->exportLinks = $exportLinks;
+ }
+
+ public function getExportLinks()
+ {
+ return $this->exportLinks;
+ }
+
+ public function setFileExtension($fileExtension)
+ {
+ $this->fileExtension = $fileExtension;
+ }
+
+ public function getFileExtension()
+ {
+ return $this->fileExtension;
+ }
+
+ public function setFileSize($fileSize)
+ {
+ $this->fileSize = $fileSize;
+ }
+
+ public function getFileSize()
+ {
+ return $this->fileSize;
+ }
+
+ public function setHeadRevisionId($headRevisionId)
+ {
+ $this->headRevisionId = $headRevisionId;
+ }
+
+ public function getHeadRevisionId()
+ {
+ return $this->headRevisionId;
+ }
+
+ public function setIconLink($iconLink)
+ {
+ $this->iconLink = $iconLink;
+ }
+
+ public function getIconLink()
+ {
+ return $this->iconLink;
+ }
+
+ public function setId($id)
+ {
+ $this->id = $id;
+ }
+
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ public function setImageMediaMetadata(Google_Service_Drive_DriveFileImageMediaMetadata $imageMediaMetadata)
+ {
+ $this->imageMediaMetadata = $imageMediaMetadata;
+ }
+
+ public function getImageMediaMetadata()
+ {
+ return $this->imageMediaMetadata;
+ }
+
+ public function setIndexableText(Google_Service_Drive_DriveFileIndexableText $indexableText)
+ {
+ $this->indexableText = $indexableText;
+ }
+
+ public function getIndexableText()
+ {
+ return $this->indexableText;
+ }
+
+ public function setKind($kind)
+ {
+ $this->kind = $kind;
+ }
+
+ public function getKind()
+ {
+ return $this->kind;
+ }
+
+ public function setLabels(Google_Service_Drive_DriveFileLabels $labels)
+ {
+ $this->labels = $labels;
+ }
+
+ public function getLabels()
+ {
+ return $this->labels;
+ }
+
+ public function setLastModifyingUser(Google_Service_Drive_User $lastModifyingUser)
+ {
+ $this->lastModifyingUser = $lastModifyingUser;
+ }
+
+ public function getLastModifyingUser()
+ {
+ return $this->lastModifyingUser;
+ }
+
+ public function setLastModifyingUserName($lastModifyingUserName)
+ {
+ $this->lastModifyingUserName = $lastModifyingUserName;
+ }
+
+ public function getLastModifyingUserName()
+ {
+ return $this->lastModifyingUserName;
+ }
+
+ public function setLastViewedByMeDate($lastViewedByMeDate)
+ {
+ $this->lastViewedByMeDate = $lastViewedByMeDate;
+ }
+
+ public function getLastViewedByMeDate()
+ {
+ return $this->lastViewedByMeDate;
+ }
+
+ public function setMarkedViewedByMeDate($markedViewedByMeDate)
+ {
+ $this->markedViewedByMeDate = $markedViewedByMeDate;
+ }
+
+ public function getMarkedViewedByMeDate()
+ {
+ return $this->markedViewedByMeDate;
+ }
+
+ public function setMd5Checksum($md5Checksum)
+ {
+ $this->md5Checksum = $md5Checksum;
+ }
+
+ public function getMd5Checksum()
+ {
+ return $this->md5Checksum;
+ }
+
+ public function setMimeType($mimeType)
+ {
+ $this->mimeType = $mimeType;
+ }
+
+ public function getMimeType()
+ {
+ return $this->mimeType;
+ }
+
+ public function setModifiedByMeDate($modifiedByMeDate)
+ {
+ $this->modifiedByMeDate = $modifiedByMeDate;
+ }
+
+ public function getModifiedByMeDate()
+ {
+ return $this->modifiedByMeDate;
+ }
+
+ public function setModifiedDate($modifiedDate)
+ {
+ $this->modifiedDate = $modifiedDate;
+ }
+
+ public function getModifiedDate()
+ {
+ return $this->modifiedDate;
+ }
+
+ public function setOpenWithLinks($openWithLinks)
+ {
+ $this->openWithLinks = $openWithLinks;
+ }
+
+ public function getOpenWithLinks()
+ {
+ return $this->openWithLinks;
+ }
+
+ public function setOriginalFilename($originalFilename)
+ {
+ $this->originalFilename = $originalFilename;
+ }
+
+ public function getOriginalFilename()
+ {
+ return $this->originalFilename;
+ }
+
+ public function setOwnerNames($ownerNames)
+ {
+ $this->ownerNames = $ownerNames;
+ }
+
+ public function getOwnerNames()
+ {
+ return $this->ownerNames;
+ }
+
+ public function setOwners($owners)
+ {
+ $this->owners = $owners;
+ }
+
+ public function getOwners()
+ {
+ return $this->owners;
+ }
+
+ public function setParents($parents)
+ {
+ $this->parents = $parents;
+ }
+
+ public function getParents()
+ {
+ return $this->parents;
+ }
+
+ public function setPermissions($permissions)
+ {
+ $this->permissions = $permissions;
+ }
+
+ public function getPermissions()
+ {
+ return $this->permissions;
+ }
+
+ public function setProperties($properties)
+ {
+ $this->properties = $properties;
+ }
+
+ public function getProperties()
+ {
+ return $this->properties;
+ }
+
+ public function setQuotaBytesUsed($quotaBytesUsed)
+ {
+ $this->quotaBytesUsed = $quotaBytesUsed;
+ }
+
+ public function getQuotaBytesUsed()
+ {
+ return $this->quotaBytesUsed;
+ }
+
+ public function setSelfLink($selfLink)
+ {
+ $this->selfLink = $selfLink;
+ }
+
+ public function getSelfLink()
+ {
+ return $this->selfLink;
+ }
+
+ public function setShared($shared)
+ {
+ $this->shared = $shared;
+ }
+
+ public function getShared()
+ {
+ return $this->shared;
+ }
+
+ public function setSharedWithMeDate($sharedWithMeDate)
+ {
+ $this->sharedWithMeDate = $sharedWithMeDate;
+ }
+
+ public function getSharedWithMeDate()
+ {
+ return $this->sharedWithMeDate;
+ }
+
+ public function setSharingUser(Google_Service_Drive_User $sharingUser)
+ {
+ $this->sharingUser = $sharingUser;
+ }
+
+ public function getSharingUser()
+ {
+ return $this->sharingUser;
+ }
+
+ public function setThumbnail(Google_Service_Drive_DriveFileThumbnail $thumbnail)
+ {
+ $this->thumbnail = $thumbnail;
+ }
+
+ public function getThumbnail()
+ {
+ return $this->thumbnail;
+ }
+
+ public function setThumbnailLink($thumbnailLink)
+ {
+ $this->thumbnailLink = $thumbnailLink;
+ }
+
+ public function getThumbnailLink()
+ {
+ return $this->thumbnailLink;
+ }
+
+ public function setTitle($title)
+ {
+ $this->title = $title;
+ }
+
+ public function getTitle()
+ {
+ return $this->title;
+ }
+
+ public function setUserPermission(Google_Service_Drive_Permission $userPermission)
+ {
+ $this->userPermission = $userPermission;
+ }
+
+ public function getUserPermission()
+ {
+ return $this->userPermission;
+ }
+
+ public function setVersion($version)
+ {
+ $this->version = $version;
+ }
+
+ public function getVersion()
+ {
+ return $this->version;
+ }
+
+ public function setVideoMediaMetadata(Google_Service_Drive_DriveFileVideoMediaMetadata $videoMediaMetadata)
+ {
+ $this->videoMediaMetadata = $videoMediaMetadata;
+ }
+
+ public function getVideoMediaMetadata()
+ {
+ return $this->videoMediaMetadata;
+ }
+
+ public function setWebContentLink($webContentLink)
+ {
+ $this->webContentLink = $webContentLink;
+ }
+
+ public function getWebContentLink()
+ {
+ return $this->webContentLink;
+ }
+
+ public function setWebViewLink($webViewLink)
+ {
+ $this->webViewLink = $webViewLink;
+ }
+
+ public function getWebViewLink()
+ {
+ return $this->webViewLink;
+ }
+
+ public function setWritersCanShare($writersCanShare)
+ {
+ $this->writersCanShare = $writersCanShare;
+ }
+
+ public function getWritersCanShare()
+ {
+ return $this->writersCanShare;
+ }
+}
+
+class Google_Service_Drive_DriveFileExportLinks extends Google_Model
+{
+ protected $internal_gapi_mappings = array(
+ );
+}
+
+class Google_Service_Drive_DriveFileImageMediaMetadata extends Google_Model
+{
+ protected $internal_gapi_mappings = array(
+ );
+ public $aperture;
+ public $cameraMake;
+ public $cameraModel;
+ public $colorSpace;
+ public $date;
+ public $exposureBias;
+ public $exposureMode;
+ public $exposureTime;
+ public $flashUsed;
+ public $focalLength;
+ public $height;
+ public $isoSpeed;
+ public $lens;
+ protected $locationType = 'Google_Service_Drive_DriveFileImageMediaMetadataLocation';
+ protected $locationDataType = '';
+ public $maxApertureValue;
+ public $meteringMode;
+ public $rotation;
+ public $sensor;
+ public $subjectDistance;
+ public $whiteBalance;
+ public $width;
+
+ public function setAperture($aperture)
+ {
+ $this->aperture = $aperture;
+ }
+
+ public function getAperture()
+ {
+ return $this->aperture;
+ }
+
+ public function setCameraMake($cameraMake)
+ {
+ $this->cameraMake = $cameraMake;
+ }
+
+ public function getCameraMake()
+ {
+ return $this->cameraMake;
+ }
+
+ public function setCameraModel($cameraModel)
+ {
+ $this->cameraModel = $cameraModel;
+ }
+
+ public function getCameraModel()
+ {
+ return $this->cameraModel;
+ }
+
+ public function setColorSpace($colorSpace)
+ {
+ $this->colorSpace = $colorSpace;
+ }
+
+ public function getColorSpace()
+ {
+ return $this->colorSpace;
+ }
+
+ public function setDate($date)
+ {
+ $this->date = $date;
+ }
+
+ public function getDate()
+ {
+ return $this->date;
+ }
+
+ public function setExposureBias($exposureBias)
+ {
+ $this->exposureBias = $exposureBias;
+ }
+
+ public function getExposureBias()
+ {
+ return $this->exposureBias;
+ }
+
+ public function setExposureMode($exposureMode)
+ {
+ $this->exposureMode = $exposureMode;
+ }
+
+ public function getExposureMode()
+ {
+ return $this->exposureMode;
+ }
+
+ public function setExposureTime($exposureTime)
+ {
+ $this->exposureTime = $exposureTime;
+ }
+
+ public function getExposureTime()
+ {
+ return $this->exposureTime;
+ }
+
+ public function setFlashUsed($flashUsed)
+ {
+ $this->flashUsed = $flashUsed;
+ }
+
+ public function getFlashUsed()
+ {
+ return $this->flashUsed;
+ }
+
+ public function setFocalLength($focalLength)
+ {
+ $this->focalLength = $focalLength;
+ }
+
+ public function getFocalLength()
+ {
+ return $this->focalLength;
+ }
+
+ public function setHeight($height)
+ {
+ $this->height = $height;
+ }
+
+ public function getHeight()
+ {
+ return $this->height;
+ }
+
+ public function setIsoSpeed($isoSpeed)
+ {
+ $this->isoSpeed = $isoSpeed;
+ }
+
+ public function getIsoSpeed()
+ {
+ return $this->isoSpeed;
+ }
+
+ public function setLens($lens)
+ {
+ $this->lens = $lens;
+ }
+
+ public function getLens()
+ {
+ return $this->lens;
+ }
+
+ public function setLocation(Google_Service_Drive_DriveFileImageMediaMetadataLocation $location)
+ {
+ $this->location = $location;
+ }
+
+ public function getLocation()
+ {
+ return $this->location;
+ }
+
+ public function setMaxApertureValue($maxApertureValue)
+ {
+ $this->maxApertureValue = $maxApertureValue;
+ }
+
+ public function getMaxApertureValue()
+ {
+ return $this->maxApertureValue;
+ }
+
+ public function setMeteringMode($meteringMode)
+ {
+ $this->meteringMode = $meteringMode;
+ }
+
+ public function getMeteringMode()
+ {
+ return $this->meteringMode;
+ }
+
+ public function setRotation($rotation)
+ {
+ $this->rotation = $rotation;
+ }
+
+ public function getRotation()
+ {
+ return $this->rotation;
+ }
+
+ public function setSensor($sensor)
+ {
+ $this->sensor = $sensor;
+ }
+
+ public function getSensor()
+ {
+ return $this->sensor;
+ }
+
+ public function setSubjectDistance($subjectDistance)
+ {
+ $this->subjectDistance = $subjectDistance;
+ }
+
+ public function getSubjectDistance()
+ {
+ return $this->subjectDistance;
+ }
+
+ public function setWhiteBalance($whiteBalance)
+ {
+ $this->whiteBalance = $whiteBalance;
+ }
+
+ public function getWhiteBalance()
+ {
+ return $this->whiteBalance;
+ }
+
+ public function setWidth($width)
+ {
+ $this->width = $width;
+ }
+
+ public function getWidth()
+ {
+ return $this->width;
+ }
+}
+
+class Google_Service_Drive_DriveFileImageMediaMetadataLocation extends Google_Model
+{
+ protected $internal_gapi_mappings = array(
+ );
+ public $altitude;
+ public $latitude;
+ public $longitude;
+
+ public function setAltitude($altitude)
+ {
+ $this->altitude = $altitude;
+ }
+
+ public function getAltitude()
+ {
+ return $this->altitude;
+ }
+
+ public function setLatitude($latitude)
+ {
+ $this->latitude = $latitude;
+ }
+
+ public function getLatitude()
+ {
+ return $this->latitude;
+ }
+
+ public function setLongitude($longitude)
+ {
+ $this->longitude = $longitude;
+ }
+
+ public function getLongitude()
+ {
+ return $this->longitude;
+ }
+}
+
+class Google_Service_Drive_DriveFileIndexableText extends Google_Model
+{
+ protected $internal_gapi_mappings = array(
+ );
+ public $text;
+
+ public function setText($text)
+ {
+ $this->text = $text;
+ }
+
+ public function getText()
+ {
+ return $this->text;
+ }
+}
+
+class Google_Service_Drive_DriveFileLabels extends Google_Model
+{
+ protected $internal_gapi_mappings = array(
+ );
+ public $hidden;
+ public $restricted;
+ public $starred;
+ public $trashed;
+ public $viewed;
+
+ public function setHidden($hidden)
+ {
+ $this->hidden = $hidden;
+ }
+
+ public function getHidden()
+ {
+ return $this->hidden;
+ }
+
+ public function setRestricted($restricted)
+ {
+ $this->restricted = $restricted;
+ }
+
+ public function getRestricted()
+ {
+ return $this->restricted;
+ }
+
+ public function setStarred($starred)
+ {
+ $this->starred = $starred;
+ }
+
+ public function getStarred()
+ {
+ return $this->starred;
+ }
+
+ public function setTrashed($trashed)
+ {
+ $this->trashed = $trashed;
+ }
+
+ public function getTrashed()
+ {
+ return $this->trashed;
+ }
+
+ public function setViewed($viewed)
+ {
+ $this->viewed = $viewed;
+ }
+
+ public function getViewed()
+ {
+ return $this->viewed;
+ }
+}
+
+class Google_Service_Drive_DriveFileOpenWithLinks extends Google_Model
+{
+ protected $internal_gapi_mappings = array(
+ );
+}
+
+class Google_Service_Drive_DriveFileThumbnail extends Google_Model
+{
+ protected $internal_gapi_mappings = array(
+ );
+ public $image;
+ public $mimeType;
+
+ public function setImage($image)
+ {
+ $this->image = $image;
+ }
+
+ public function getImage()
+ {
+ return $this->image;
+ }
+
+ public function setMimeType($mimeType)
+ {
+ $this->mimeType = $mimeType;
+ }
+
+ public function getMimeType()
+ {
+ return $this->mimeType;
+ }
+}
+
+class Google_Service_Drive_DriveFileVideoMediaMetadata extends Google_Model
+{
+ protected $internal_gapi_mappings = array(
+ );
+ public $durationMillis;
+ public $height;
+ public $width;
+
+ public function setDurationMillis($durationMillis)
+ {
+ $this->durationMillis = $durationMillis;
+ }
+
+ public function getDurationMillis()
+ {
+ return $this->durationMillis;
+ }
+
+ public function setHeight($height)
+ {
+ $this->height = $height;
+ }
+
+ public function getHeight()
+ {
+ return $this->height;
+ }
+
+ public function setWidth($width)
+ {
+ $this->width = $width;
+ }
+
+ public function getWidth()
+ {
+ return $this->width;
+ }
+}
+
+class Google_Service_Drive_FileList extends Google_Collection
+{
+ protected $collection_key = 'items';
+ protected $internal_gapi_mappings = array(
+ );
+ public $etag;
+ protected $itemsType = 'Google_Service_Drive_DriveFile';
+ protected $itemsDataType = 'array';
+ public $kind;
+ public $nextLink;
+ public $nextPageToken;
+ public $selfLink;
+
+ public function setEtag($etag)
+ {
+ $this->etag = $etag;
+ }
+
+ public function getEtag()
+ {
+ return $this->etag;
+ }
+
+ public function setItems($items)
+ {
+ $this->items = $items;
+ }
+
+ public function getItems()
+ {
+ return $this->items;
+ }
+
+ public function setKind($kind)
+ {
+ $this->kind = $kind;
+ }
+
+ public function getKind()
+ {
+ return $this->kind;
+ }
+
+ public function setNextLink($nextLink)
+ {
+ $this->nextLink = $nextLink;
+ }
+
+ public function getNextLink()
+ {
+ return $this->nextLink;
+ }
+
+ public function setNextPageToken($nextPageToken)
+ {
+ $this->nextPageToken = $nextPageToken;
+ }
+
+ public function getNextPageToken()
+ {
+ return $this->nextPageToken;
+ }
+
+ public function setSelfLink($selfLink)
+ {
+ $this->selfLink = $selfLink;
+ }
+
+ public function getSelfLink()
+ {
+ return $this->selfLink;
+ }
+}
+
+class Google_Service_Drive_ParentList extends Google_Collection
+{
+ protected $collection_key = 'items';
+ protected $internal_gapi_mappings = array(
+ );
+ public $etag;
+ protected $itemsType = 'Google_Service_Drive_ParentReference';
+ protected $itemsDataType = 'array';
+ public $kind;
+ public $selfLink;
+
+ public function setEtag($etag)
+ {
+ $this->etag = $etag;
+ }
+
+ public function getEtag()
+ {
+ return $this->etag;
+ }
+
+ public function setItems($items)
+ {
+ $this->items = $items;
+ }
+
+ public function getItems()
+ {
+ return $this->items;
+ }
+
+ public function setKind($kind)
+ {
+ $this->kind = $kind;
+ }
+
+ public function getKind()
+ {
+ return $this->kind;
+ }
+
+ public function setSelfLink($selfLink)
+ {
+ $this->selfLink = $selfLink;
+ }
+
+ public function getSelfLink()
+ {
+ return $this->selfLink;
+ }
+}
+
+class Google_Service_Drive_ParentReference extends Google_Model
+{
+ protected $internal_gapi_mappings = array(
+ );
+ public $id;
+ public $isRoot;
+ public $kind;
+ public $parentLink;
+ public $selfLink;
+
+ public function setId($id)
+ {
+ $this->id = $id;
+ }
+
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ public function setIsRoot($isRoot)
+ {
+ $this->isRoot = $isRoot;
+ }
+
+ public function getIsRoot()
+ {
+ return $this->isRoot;
+ }
+
+ public function setKind($kind)
+ {
+ $this->kind = $kind;
+ }
+
+ public function getKind()
+ {
+ return $this->kind;
+ }
+
+ public function setParentLink($parentLink)
+ {
+ $this->parentLink = $parentLink;
+ }
+
+ public function getParentLink()
+ {
+ return $this->parentLink;
+ }
+
+ public function setSelfLink($selfLink)
+ {
+ $this->selfLink = $selfLink;
+ }
+
+ public function getSelfLink()
+ {
+ return $this->selfLink;
+ }
+}
+
+class Google_Service_Drive_Permission extends Google_Collection
+{
+ protected $collection_key = 'additionalRoles';
+ protected $internal_gapi_mappings = array(
+ );
+ public $additionalRoles;
+ public $authKey;
+ public $domain;
+ public $emailAddress;
+ public $etag;
+ public $id;
+ public $kind;
+ public $name;
+ public $photoLink;
+ public $role;
+ public $selfLink;
+ public $type;
+ public $value;
+ public $withLink;
+
+ public function setAdditionalRoles($additionalRoles)
+ {
+ $this->additionalRoles = $additionalRoles;
+ }
+
+ public function getAdditionalRoles()
+ {
+ return $this->additionalRoles;
+ }
+
+ public function setAuthKey($authKey)
+ {
+ $this->authKey = $authKey;
+ }
+
+ public function getAuthKey()
+ {
+ return $this->authKey;
+ }
+
+ public function setDomain($domain)
+ {
+ $this->domain = $domain;
+ }
+
+ public function getDomain()
+ {
+ return $this->domain;
+ }
+
+ public function setEmailAddress($emailAddress)
+ {
+ $this->emailAddress = $emailAddress;
+ }
+
+ public function getEmailAddress()
+ {
+ return $this->emailAddress;
+ }
+
+ public function setEtag($etag)
+ {
+ $this->etag = $etag;
+ }
+
+ public function getEtag()
+ {
+ return $this->etag;
+ }
+
+ public function setId($id)
+ {
+ $this->id = $id;
+ }
+
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ public function setKind($kind)
+ {
+ $this->kind = $kind;
+ }
+
+ public function getKind()
+ {
+ return $this->kind;
+ }
+
+ public function setName($name)
+ {
+ $this->name = $name;
+ }
+
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ public function setPhotoLink($photoLink)
+ {
+ $this->photoLink = $photoLink;
+ }
+
+ public function getPhotoLink()
+ {
+ return $this->photoLink;
+ }
+
+ public function setRole($role)
+ {
+ $this->role = $role;
+ }
+
+ public function getRole()
+ {
+ return $this->role;
+ }
+
+ public function setSelfLink($selfLink)
+ {
+ $this->selfLink = $selfLink;
+ }
+
+ public function getSelfLink()
+ {
+ return $this->selfLink;
+ }
+
+ public function setType($type)
+ {
+ $this->type = $type;
+ }
+
+ public function getType()
+ {
+ return $this->type;
+ }
+
+ public function setValue($value)
+ {
+ $this->value = $value;
+ }
+
+ public function getValue()
+ {
+ return $this->value;
+ }
+
+ public function setWithLink($withLink)
+ {
+ $this->withLink = $withLink;
+ }
+
+ public function getWithLink()
+ {
+ return $this->withLink;
+ }
+}
+
+class Google_Service_Drive_PermissionId extends Google_Model
+{
+ protected $internal_gapi_mappings = array(
+ );
+ public $id;
+ public $kind;
+
+ public function setId($id)
+ {
+ $this->id = $id;
+ }
+
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ public function setKind($kind)
+ {
+ $this->kind = $kind;
+ }
+
+ public function getKind()
+ {
+ return $this->kind;
+ }
+}
+
+class Google_Service_Drive_PermissionList extends Google_Collection
+{
+ protected $collection_key = 'items';
+ protected $internal_gapi_mappings = array(
+ );
+ public $etag;
+ protected $itemsType = 'Google_Service_Drive_Permission';
+ protected $itemsDataType = 'array';
+ public $kind;
+ public $selfLink;
+
+ public function setEtag($etag)
+ {
+ $this->etag = $etag;
+ }
+
+ public function getEtag()
+ {
+ return $this->etag;
+ }
+
+ public function setItems($items)
+ {
+ $this->items = $items;
+ }
+
+ public function getItems()
+ {
+ return $this->items;
+ }
+
+ public function setKind($kind)
+ {
+ $this->kind = $kind;
+ }
+
+ public function getKind()
+ {
+ return $this->kind;
+ }
+
+ public function setSelfLink($selfLink)
+ {
+ $this->selfLink = $selfLink;
+ }
+
+ public function getSelfLink()
+ {
+ return $this->selfLink;
+ }
+}
+
+class Google_Service_Drive_Property extends Google_Model
+{
+ protected $internal_gapi_mappings = array(
+ );
+ public $etag;
+ public $key;
+ public $kind;
+ public $selfLink;
+ public $value;
+ public $visibility;
+
+ public function setEtag($etag)
+ {
+ $this->etag = $etag;
+ }
+
+ public function getEtag()
+ {
+ return $this->etag;
+ }
+
+ public function setKey($key)
+ {
+ $this->key = $key;
+ }
+
+ public function getKey()
+ {
+ return $this->key;
+ }
+
+ public function setKind($kind)
+ {
+ $this->kind = $kind;
+ }
+
+ public function getKind()
+ {
+ return $this->kind;
+ }
+
+ public function setSelfLink($selfLink)
+ {
+ $this->selfLink = $selfLink;
+ }
+
+ public function getSelfLink()
+ {
+ return $this->selfLink;
+ }
+
+ public function setValue($value)
+ {
+ $this->value = $value;
+ }
+
+ public function getValue()
+ {
+ return $this->value;
+ }
+
+ public function setVisibility($visibility)
+ {
+ $this->visibility = $visibility;
+ }
+
+ public function getVisibility()
+ {
+ return $this->visibility;
+ }
+}
+
+class Google_Service_Drive_PropertyList extends Google_Collection
+{
+ protected $collection_key = 'items';
+ protected $internal_gapi_mappings = array(
+ );
+ public $etag;
+ protected $itemsType = 'Google_Service_Drive_Property';
+ protected $itemsDataType = 'array';
+ public $kind;
+ public $selfLink;
+
+ public function setEtag($etag)
+ {
+ $this->etag = $etag;
+ }
+
+ public function getEtag()
+ {
+ return $this->etag;
+ }
+
+ public function setItems($items)
+ {
+ $this->items = $items;
+ }
+
+ public function getItems()
+ {
+ return $this->items;
+ }
+
+ public function setKind($kind)
+ {
+ $this->kind = $kind;
+ }
+
+ public function getKind()
+ {
+ return $this->kind;
+ }
+
+ public function setSelfLink($selfLink)
+ {
+ $this->selfLink = $selfLink;
+ }
+
+ public function getSelfLink()
+ {
+ return $this->selfLink;
+ }
+}
+
+class Google_Service_Drive_Revision extends Google_Model
+{
+ protected $internal_gapi_mappings = array(
+ );
+ public $downloadUrl;
+ public $etag;
+ public $exportLinks;
+ public $fileSize;
+ public $id;
+ public $kind;
+ protected $lastModifyingUserType = 'Google_Service_Drive_User';
+ protected $lastModifyingUserDataType = '';
+ public $lastModifyingUserName;
+ public $md5Checksum;
+ public $mimeType;
+ public $modifiedDate;
+ public $originalFilename;
+ public $pinned;
+ public $publishAuto;
+ public $published;
+ public $publishedLink;
+ public $publishedOutsideDomain;
+ public $selfLink;
+
+ public function setDownloadUrl($downloadUrl)
+ {
+ $this->downloadUrl = $downloadUrl;
+ }
+
+ public function getDownloadUrl()
+ {
+ return $this->downloadUrl;
+ }
+
+ public function setEtag($etag)
+ {
+ $this->etag = $etag;
+ }
+
+ public function getEtag()
+ {
+ return $this->etag;
+ }
+
+ public function setExportLinks($exportLinks)
+ {
+ $this->exportLinks = $exportLinks;
+ }
+
+ public function getExportLinks()
+ {
+ return $this->exportLinks;
+ }
+
+ public function setFileSize($fileSize)
+ {
+ $this->fileSize = $fileSize;
+ }
+
+ public function getFileSize()
+ {
+ return $this->fileSize;
+ }
+
+ public function setId($id)
+ {
+ $this->id = $id;
+ }
+
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ public function setKind($kind)
+ {
+ $this->kind = $kind;
+ }
+
+ public function getKind()
+ {
+ return $this->kind;
+ }
+
+ public function setLastModifyingUser(Google_Service_Drive_User $lastModifyingUser)
+ {
+ $this->lastModifyingUser = $lastModifyingUser;
+ }
+
+ public function getLastModifyingUser()
+ {
+ return $this->lastModifyingUser;
+ }
+
+ public function setLastModifyingUserName($lastModifyingUserName)
+ {
+ $this->lastModifyingUserName = $lastModifyingUserName;
+ }
+
+ public function getLastModifyingUserName()
+ {
+ return $this->lastModifyingUserName;
+ }
+
+ public function setMd5Checksum($md5Checksum)
+ {
+ $this->md5Checksum = $md5Checksum;
+ }
+
+ public function getMd5Checksum()
+ {
+ return $this->md5Checksum;
+ }
+
+ public function setMimeType($mimeType)
+ {
+ $this->mimeType = $mimeType;
+ }
+
+ public function getMimeType()
+ {
+ return $this->mimeType;
+ }
+
+ public function setModifiedDate($modifiedDate)
+ {
+ $this->modifiedDate = $modifiedDate;
+ }
+
+ public function getModifiedDate()
+ {
+ return $this->modifiedDate;
+ }
+
+ public function setOriginalFilename($originalFilename)
+ {
+ $this->originalFilename = $originalFilename;
+ }
+
+ public function getOriginalFilename()
+ {
+ return $this->originalFilename;
+ }
+
+ public function setPinned($pinned)
+ {
+ $this->pinned = $pinned;
+ }
+
+ public function getPinned()
+ {
+ return $this->pinned;
+ }
+
+ public function setPublishAuto($publishAuto)
+ {
+ $this->publishAuto = $publishAuto;
+ }
+
+ public function getPublishAuto()
+ {
+ return $this->publishAuto;
+ }
+
+ public function setPublished($published)
+ {
+ $this->published = $published;
+ }
+
+ public function getPublished()
+ {
+ return $this->published;
+ }
+
+ public function setPublishedLink($publishedLink)
+ {
+ $this->publishedLink = $publishedLink;
+ }
+
+ public function getPublishedLink()
+ {
+ return $this->publishedLink;
+ }
+
+ public function setPublishedOutsideDomain($publishedOutsideDomain)
+ {
+ $this->publishedOutsideDomain = $publishedOutsideDomain;
+ }
+
+ public function getPublishedOutsideDomain()
+ {
+ return $this->publishedOutsideDomain;
+ }
+
+ public function setSelfLink($selfLink)
+ {
+ $this->selfLink = $selfLink;
+ }
+
+ public function getSelfLink()
+ {
+ return $this->selfLink;
+ }
+}
+
+class Google_Service_Drive_RevisionExportLinks extends Google_Model
+{
+ protected $internal_gapi_mappings = array(
+ );
+}
+
+class Google_Service_Drive_RevisionList extends Google_Collection
+{
+ protected $collection_key = 'items';
+ protected $internal_gapi_mappings = array(
+ );
+ public $etag;
+ protected $itemsType = 'Google_Service_Drive_Revision';
+ protected $itemsDataType = 'array';
+ public $kind;
+ public $selfLink;
+
+ public function setEtag($etag)
+ {
+ $this->etag = $etag;
+ }
+
+ public function getEtag()
+ {
+ return $this->etag;
+ }
+
+ public function setItems($items)
+ {
+ $this->items = $items;
+ }
+
+ public function getItems()
+ {
+ return $this->items;
+ }
+
+ public function setKind($kind)
+ {
+ $this->kind = $kind;
+ }
+
+ public function getKind()
+ {
+ return $this->kind;
+ }
+
+ public function setSelfLink($selfLink)
+ {
+ $this->selfLink = $selfLink;
+ }
+
+ public function getSelfLink()
+ {
+ return $this->selfLink;
+ }
+}
+
+class Google_Service_Drive_User extends Google_Model
+{
+ protected $internal_gapi_mappings = array(
+ );
+ public $displayName;
+ public $emailAddress;
+ public $isAuthenticatedUser;
+ public $kind;
+ public $permissionId;
+ protected $pictureType = 'Google_Service_Drive_UserPicture';
+ protected $pictureDataType = '';
+
+ public function setDisplayName($displayName)
+ {
+ $this->displayName = $displayName;
+ }
+
+ public function getDisplayName()
+ {
+ return $this->displayName;
+ }
+
+ public function setEmailAddress($emailAddress)
+ {
+ $this->emailAddress = $emailAddress;
+ }
+
+ public function getEmailAddress()
+ {
+ return $this->emailAddress;
+ }
+
+ public function setIsAuthenticatedUser($isAuthenticatedUser)
+ {
+ $this->isAuthenticatedUser = $isAuthenticatedUser;
+ }
+
+ public function getIsAuthenticatedUser()
+ {
+ return $this->isAuthenticatedUser;
+ }
+
+ public function setKind($kind)
+ {
+ $this->kind = $kind;
+ }
+
+ public function getKind()
+ {
+ return $this->kind;
+ }
+
+ public function setPermissionId($permissionId)
+ {
+ $this->permissionId = $permissionId;
+ }
+
+ public function getPermissionId()
+ {
+ return $this->permissionId;
+ }
+
+ public function setPicture(Google_Service_Drive_UserPicture $picture)
+ {
+ $this->picture = $picture;
+ }
+
+ public function getPicture()
+ {
+ return $this->picture;
+ }
+}
+
+class Google_Service_Drive_UserPicture extends Google_Model
+{
+ protected $internal_gapi_mappings = array(
+ );
+ public $url;
+
+ public function setUrl($url)
+ {
+ $this->url = $url;
+ }
+
+ public function getUrl()
+ {
+ return $this->url;
+ }
+}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Service/Exception.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Service/Exception.php
new file mode 100644
index 00000000000..a780ff7b47c
--- /dev/null
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Service/Exception.php
@@ -0,0 +1,53 @@
+<?php
+
+require_once 'Google/Exception.php';
+
+class Google_Service_Exception extends Google_Exception
+{
+ /**
+ * Optional list of errors returned in a JSON body of an HTTP error response.
+ */
+ protected $errors = array();
+
+ /**
+ * Override default constructor to add ability to set $errors.
+ *
+ * @param string $message
+ * @param int $code
+ * @param Exception|null $previous
+ * @param [{string, string}] errors List of errors returned in an HTTP
+ * response. Defaults to [].
+ */
+ public function __construct(
+ $message,
+ $code = 0,
+ Exception $previous = null,
+ $errors = array()
+ ) {
+ if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
+ parent::__construct($message, $code, $previous);
+ } else {
+ parent::__construct($message, $code);
+ }
+
+ $this->errors = $errors;
+ }
+
+ /**
+ * An example of the possible errors returned.
+ *
+ * {
+ * "domain": "global",
+ * "reason": "authError",
+ * "message": "Invalid Credentials",
+ * "locationType": "header",
+ * "location": "Authorization",
+ * }
+ *
+ * @return [{string, string}] List of errors return in an HTTP response or [].
+ */
+ public function getErrors()
+ {
+ return $this->errors;
+ }
+}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Service/Resource.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Service/Resource.php
new file mode 100644
index 00000000000..d396907e1d0
--- /dev/null
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Service/Resource.php
@@ -0,0 +1,210 @@
+<?php
+/**
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+require_once 'Google/Client.php';
+require_once 'Google/Exception.php';
+require_once 'Google/Utils.php';
+require_once 'Google/Http/Request.php';
+require_once 'Google/Http/MediaFileUpload.php';
+require_once 'Google/Http/REST.php';
+
+/**
+ * Implements the actual methods/resources of the discovered Google API using magic function
+ * calling overloading (__call()), which on call will see if the method name (plus.activities.list)
+ * is available in this service, and if so construct an apiHttpRequest representing it.
+ *
+ * @author Chris Chabot <chabotc@google.com>
+ * @author Chirag Shah <chirags@google.com>
+ *
+ */
+class Google_Service_Resource
+{
+ // Valid query parameters that work, but don't appear in discovery.
+ private $stackParameters = array(
+ 'alt' => array('type' => 'string', 'location' => 'query'),
+ 'fields' => array('type' => 'string', 'location' => 'query'),
+ 'trace' => array('type' => 'string', 'location' => 'query'),
+ 'userIp' => array('type' => 'string', 'location' => 'query'),
+ 'userip' => array('type' => 'string', 'location' => 'query'),
+ 'quotaUser' => array('type' => 'string', 'location' => 'query'),
+ 'data' => array('type' => 'string', 'location' => 'body'),
+ 'mimeType' => array('type' => 'string', 'location' => 'header'),
+ 'uploadType' => array('type' => 'string', 'location' => 'query'),
+ 'mediaUpload' => array('type' => 'complex', 'location' => 'query'),
+ );
+
+ /** @var Google_Service $service */
+ private $service;
+
+ /** @var Google_Client $client */
+ private $client;
+
+ /** @var string $serviceName */
+ private $serviceName;
+
+ /** @var string $resourceName */
+ private $resourceName;
+
+ /** @var array $methods */
+ private $methods;
+
+ public function __construct($service, $serviceName, $resourceName, $resource)
+ {
+ $this->service = $service;
+ $this->client = $service->getClient();
+ $this->serviceName = $serviceName;
+ $this->resourceName = $resourceName;
+ $this->methods = isset($resource['methods']) ?
+ $resource['methods'] :
+ array($resourceName => $resource);
+ }
+
+ /**
+ * TODO(ianbarber): This function needs simplifying.
+ * @param $name
+ * @param $arguments
+ * @param $expected_class - optional, the expected class name
+ * @return Google_Http_Request|expected_class
+ * @throws Google_Exception
+ */
+ public function call($name, $arguments, $expected_class = null)
+ {
+ if (! isset($this->methods[$name])) {
+ throw new Google_Exception(
+ "Unknown function: " .
+ "{$this->serviceName}->{$this->resourceName}->{$name}()"
+ );
+ }
+ $method = $this->methods[$name];
+ $parameters = $arguments[0];
+
+ // postBody is a special case since it's not defined in the discovery
+ // document as parameter, but we abuse the param entry for storing it.
+ $postBody = null;
+ if (isset($parameters['postBody'])) {
+ if ($parameters['postBody'] instanceof Google_Model) {
+ // In the cases the post body is an existing object, we want
+ // to use the smart method to create a simple object for
+ // for JSONification.
+ $parameters['postBody'] = $parameters['postBody']->toSimpleObject();
+ } else if (is_object($parameters['postBody'])) {
+ // If the post body is another kind of object, we will try and
+ // wrangle it into a sensible format.
+ $parameters['postBody'] =
+ $this->convertToArrayAndStripNulls($parameters['postBody']);
+ }
+ $postBody = json_encode($parameters['postBody']);
+ unset($parameters['postBody']);
+ }
+
+ // TODO(ianbarber): optParams here probably should have been
+ // handled already - this may well be redundant code.
+ if (isset($parameters['optParams'])) {
+ $optParams = $parameters['optParams'];
+ unset($parameters['optParams']);
+ $parameters = array_merge($parameters, $optParams);
+ }
+
+ if (!isset($method['parameters'])) {
+ $method['parameters'] = array();
+ }
+
+ $method['parameters'] = array_merge(
+ $method['parameters'],
+ $this->stackParameters
+ );
+ foreach ($parameters as $key => $val) {
+ if ($key != 'postBody' && ! isset($method['parameters'][$key])) {
+ throw new Google_Exception("($name) unknown parameter: '$key'");
+ }
+ }
+
+ foreach ($method['parameters'] as $paramName => $paramSpec) {
+ if (isset($paramSpec['required']) &&
+ $paramSpec['required'] &&
+ ! isset($parameters[$paramName])
+ ) {
+ throw new Google_Exception("($name) missing required param: '$paramName'");
+ }
+ if (isset($parameters[$paramName])) {
+ $value = $parameters[$paramName];
+ $parameters[$paramName] = $paramSpec;
+ $parameters[$paramName]['value'] = $value;
+ unset($parameters[$paramName]['required']);
+ } else {
+ // Ensure we don't pass nulls.
+ unset($parameters[$paramName]);
+ }
+ }
+
+ $servicePath = $this->service->servicePath;
+
+ $url = Google_Http_REST::createRequestUri(
+ $servicePath,
+ $method['path'],
+ $parameters
+ );
+ $httpRequest = new Google_Http_Request(
+ $url,
+ $method['httpMethod'],
+ null,
+ $postBody
+ );
+ $httpRequest->setBaseComponent($this->client->getBasePath());
+
+ if ($postBody) {
+ $contentTypeHeader = array();
+ $contentTypeHeader['content-type'] = 'application/json; charset=UTF-8';
+ $httpRequest->setRequestHeaders($contentTypeHeader);
+ $httpRequest->setPostBody($postBody);
+ }
+
+ $httpRequest = $this->client->getAuth()->sign($httpRequest);
+ $httpRequest->setExpectedClass($expected_class);
+
+ if (isset($parameters['data']) &&
+ ($parameters['uploadType']['value'] == 'media' || $parameters['uploadType']['value'] == 'multipart')) {
+ // If we are doing a simple media upload, trigger that as a convenience.
+ $mfu = new Google_Http_MediaFileUpload(
+ $this->client,
+ $httpRequest,
+ isset($parameters['mimeType']) ? $parameters['mimeType']['value'] : 'application/octet-stream',
+ $parameters['data']['value']
+ );
+ }
+
+ if ($this->client->shouldDefer()) {
+ // If we are in batch or upload mode, return the raw request.
+ return $httpRequest;
+ }
+
+ return $this->client->execute($httpRequest);
+ }
+
+ protected function convertToArrayAndStripNulls($o)
+ {
+ $o = (array) $o;
+ foreach ($o as $k => $v) {
+ if ($v === null) {
+ unset($o[$k]);
+ } elseif (is_object($v) || is_array($v)) {
+ $o[$k] = $this->convertToArrayAndStripNulls($o[$k]);
+ }
+ }
+ return $o;
+ }
+}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_Signer.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Signer/Abstract.php
index 7892baac8df..250180920db 100644
--- a/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_Signer.php
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Signer/Abstract.php
@@ -15,14 +15,13 @@
* limitations under the License.
*/
-require_once "Google_P12Signer.php";
-
/**
* Signs data.
*
* @author Brian Eaton <beaton@google.com>
*/
-abstract class Google_Signer {
+abstract class Google_Signer_Abstract
+{
/**
* Signs data, returns the signature as binary data.
*/
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Signer/P12.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Signer/P12.php
new file mode 100644
index 00000000000..7cc6098bb63
--- /dev/null
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Signer/P12.php
@@ -0,0 +1,91 @@
+<?php
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+require_once 'Google/Auth/Exception.php';
+require_once 'Google/Signer/Abstract.php';
+
+/**
+ * Signs data.
+ *
+ * Only used for testing.
+ *
+ * @author Brian Eaton <beaton@google.com>
+ */
+class Google_Signer_P12 extends Google_Signer_Abstract
+{
+ // OpenSSL private key resource
+ private $privateKey;
+
+ // Creates a new signer from a .p12 file.
+ public function __construct($p12, $password)
+ {
+ if (!function_exists('openssl_x509_read')) {
+ throw new Google_Exception(
+ 'The Google PHP API library needs the openssl PHP extension'
+ );
+ }
+
+ // If the private key is provided directly, then this isn't in the p12
+ // format. Different versions of openssl support different p12 formats
+ // and the key from google wasn't being accepted by the version available
+ // at the time.
+ if (!$password && strpos($p12, "-----BEGIN RSA PRIVATE KEY-----") !== false) {
+ $this->privateKey = openssl_pkey_get_private($p12);
+ } else {
+ // This throws on error
+ $certs = array();
+ if (!openssl_pkcs12_read($p12, $certs, $password)) {
+ throw new Google_Auth_Exception(
+ "Unable to parse the p12 file. " .
+ "Is this a .p12 file? Is the password correct? OpenSSL error: " .
+ openssl_error_string()
+ );
+ }
+ // TODO(beaton): is this part of the contract for the openssl_pkcs12_read
+ // method? What happens if there are multiple private keys? Do we care?
+ if (!array_key_exists("pkey", $certs) || !$certs["pkey"]) {
+ throw new Google_Auth_Exception("No private key found in p12 file.");
+ }
+ $this->privateKey = openssl_pkey_get_private($certs['pkey']);
+ }
+
+ if (!$this->privateKey) {
+ throw new Google_Auth_Exception("Unable to load private key");
+ }
+ }
+
+ public function __destruct()
+ {
+ if ($this->privateKey) {
+ openssl_pkey_free($this->privateKey);
+ }
+ }
+
+ public function sign($data)
+ {
+ if (version_compare(PHP_VERSION, '5.3.0') < 0) {
+ throw new Google_Auth_Exception(
+ "PHP 5.3.0 or higher is required to use service accounts."
+ );
+ }
+ $hash = defined("OPENSSL_ALGO_SHA256") ? OPENSSL_ALGO_SHA256 : "sha256";
+ if (!openssl_sign($data, $signature, $this->privateKey, $hash)) {
+ throw new Google_Auth_Exception("Unable to sign data");
+ }
+ return $signature;
+ }
+}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/service/Google_Utils.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Utils.php
index be94902c2ed..f5ef32cd4d6 100644
--- a/apps/files_external/3rdparty/google-api-php-client/src/service/Google_Utils.php
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Utils.php
@@ -21,25 +21,33 @@
*
* @author Chirag Shah <chirags@google.com>
*/
-class Google_Utils {
- public static function urlSafeB64Encode($data) {
+class Google_Utils
+{
+ public static function urlSafeB64Encode($data)
+ {
$b64 = base64_encode($data);
- $b64 = str_replace(array('+', '/', '\r', '\n', '='),
- array('-', '_'),
- $b64);
+ $b64 = str_replace(
+ array('+', '/', '\r', '\n', '='),
+ array('-', '_'),
+ $b64
+ );
return $b64;
}
- public static function urlSafeB64Decode($b64) {
- $b64 = str_replace(array('-', '_'),
- array('+', '/'),
- $b64);
+ public static function urlSafeB64Decode($b64)
+ {
+ $b64 = str_replace(
+ array('-', '_'),
+ array('+', '/'),
+ $b64
+ );
return base64_decode($b64);
}
/**
- * Misc function used to count the number of bytes in a post body, in the world of multi-byte chars
- * and the unpredictability of strlen/mb_strlen/sizeof, this is the only way to do that in a sane
+ * Misc function used to count the number of bytes in a post body, in the
+ * world of multi-byte chars and the unpredictability of
+ * strlen/mb_strlen/sizeof, this is the only way to do that in a sane
* manner at the moment.
*
* This algorithm was originally developed for the
@@ -51,7 +59,8 @@ class Google_Utils {
* @param string $str
* @return int The number of bytes in a string.
*/
- static public function getStrLen($str) {
+ public static function getStrLen($str)
+ {
$strlenVar = strlen($str);
$d = $ret = 0;
for ($count = 0; $count < $strlenVar; ++ $count) {
@@ -61,31 +70,26 @@ class Google_Utils {
// characters U-00000000 - U-0000007F (same as ASCII)
$ret ++;
break;
-
case (($ordinalValue & 0xE0) == 0xC0):
// characters U-00000080 - U-000007FF, mask 110XXXXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$ret += 2;
break;
-
case (($ordinalValue & 0xF0) == 0xE0):
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$ret += 3;
break;
-
case (($ordinalValue & 0xF8) == 0xF0):
// characters U-00010000 - U-001FFFFF, mask 11110XXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$ret += 4;
break;
-
case (($ordinalValue & 0xFC) == 0xF8):
// characters U-00200000 - U-03FFFFFF, mask 111110XX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$ret += 5;
break;
-
case (($ordinalValue & 0xFE) == 0xFC):
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
@@ -103,7 +107,8 @@ class Google_Utils {
* @param array $arr
* @return array Normalized array.
*/
- public static function normalize($arr) {
+ public static function normalize($arr)
+ {
if (!is_array($arr)) {
return array();
}
@@ -114,4 +119,17 @@ class Google_Utils {
}
return $normalized;
}
-} \ No newline at end of file
+
+ /**
+ * Convert a string to camelCase
+ * @param string $value
+ * @return string
+ */
+ public static function camelCase($value)
+ {
+ $value = ucwords(str_replace(array('-', '_'), ' ', $value));
+ $value = str_replace(' ', '', $value);
+ $value[0] = strtolower($value[0]);
+ return $value;
+ }
+}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google/Utils/URITemplate.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Utils/URITemplate.php
new file mode 100644
index 00000000000..f5ee38bb333
--- /dev/null
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Utils/URITemplate.php
@@ -0,0 +1,333 @@
+<?php
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Implementation of levels 1-3 of the URI Template spec.
+ * @see http://tools.ietf.org/html/rfc6570
+ */
+class Google_Utils_URITemplate
+{
+ const TYPE_MAP = "1";
+ const TYPE_LIST = "2";
+ const TYPE_SCALAR = "4";
+
+ /**
+ * @var $operators array
+ * These are valid at the start of a template block to
+ * modify the way in which the variables inside are
+ * processed.
+ */
+ private $operators = array(
+ "+" => "reserved",
+ "/" => "segments",
+ "." => "dotprefix",
+ "#" => "fragment",
+ ";" => "semicolon",
+ "?" => "form",
+ "&" => "continuation"
+ );
+
+ /**
+ * @var reserved array
+ * These are the characters which should not be URL encoded in reserved
+ * strings.
+ */
+ private $reserved = array(
+ "=", ",", "!", "@", "|", ":", "/", "?", "#",
+ "[", "]",'$', "&", "'", "(", ")", "*", "+", ";"
+ );
+ private $reservedEncoded = array(
+ "%3D", "%2C", "%21", "%40", "%7C", "%3A", "%2F", "%3F",
+ "%23", "%5B", "%5D", "%24", "%26", "%27", "%28", "%29",
+ "%2A", "%2B", "%3B"
+ );
+
+ public function parse($string, array $parameters)
+ {
+ return $this->resolveNextSection($string, $parameters);
+ }
+
+ /**
+ * This function finds the first matching {...} block and
+ * executes the replacement. It then calls itself to find
+ * subsequent blocks, if any.
+ */
+ private function resolveNextSection($string, $parameters)
+ {
+ $start = strpos($string, "{");
+ if ($start === false) {
+ return $string;
+ }
+ $end = strpos($string, "}");
+ if ($end === false) {
+ return $string;
+ }
+ $string = $this->replace($string, $start, $end, $parameters);
+ return $this->resolveNextSection($string, $parameters);
+ }
+
+ private function replace($string, $start, $end, $parameters)
+ {
+ // We know a data block will have {} round it, so we can strip that.
+ $data = substr($string, $start + 1, $end - $start - 1);
+
+ // If the first character is one of the reserved operators, it effects
+ // the processing of the stream.
+ if (isset($this->operators[$data[0]])) {
+ $op = $this->operators[$data[0]];
+ $data = substr($data, 1);
+ $prefix = "";
+ $prefix_on_missing = false;
+
+ switch ($op) {
+ case "reserved":
+ // Reserved means certain characters should not be URL encoded
+ $data = $this->replaceVars($data, $parameters, ",", null, true);
+ break;
+ case "fragment":
+ // Comma separated with fragment prefix. Bare values only.
+ $prefix = "#";
+ $prefix_on_missing = true;
+ $data = $this->replaceVars($data, $parameters, ",", null, true);
+ break;
+ case "segments":
+ // Slash separated data. Bare values only.
+ $prefix = "/";
+ $data =$this->replaceVars($data, $parameters, "/");
+ break;
+ case "dotprefix":
+ // Dot separated data. Bare values only.
+ $prefix = ".";
+ $prefix_on_missing = true;
+ $data = $this->replaceVars($data, $parameters, ".");
+ break;
+ case "semicolon":
+ // Semicolon prefixed and separated. Uses the key name
+ $prefix = ";";
+ $data = $this->replaceVars($data, $parameters, ";", "=", false, true, false);
+ break;
+ case "form":
+ // Standard URL format. Uses the key name
+ $prefix = "?";
+ $data = $this->replaceVars($data, $parameters, "&", "=");
+ break;
+ case "continuation":
+ // Standard URL, but with leading ampersand. Uses key name.
+ $prefix = "&";
+ $data = $this->replaceVars($data, $parameters, "&", "=");
+ break;
+ }
+
+ // Add the initial prefix character if data is valid.
+ if ($data || ($data !== false && $prefix_on_missing)) {
+ $data = $prefix . $data;
+ }
+
+ } else {
+ // If no operator we replace with the defaults.
+ $data = $this->replaceVars($data, $parameters);
+ }
+ // This is chops out the {...} and replaces with the new section.
+ return substr($string, 0, $start) . $data . substr($string, $end + 1);
+ }
+
+ private function replaceVars(
+ $section,
+ $parameters,
+ $sep = ",",
+ $combine = null,
+ $reserved = false,
+ $tag_empty = false,
+ $combine_on_empty = true
+ ) {
+ if (strpos($section, ",") === false) {
+ // If we only have a single value, we can immediately process.
+ return $this->combine(
+ $section,
+ $parameters,
+ $sep,
+ $combine,
+ $reserved,
+ $tag_empty,
+ $combine_on_empty
+ );
+ } else {
+ // If we have multiple values, we need to split and loop over them.
+ // Each is treated individually, then glued together with the
+ // separator character.
+ $vars = explode(",", $section);
+ return $this->combineList(
+ $vars,
+ $sep,
+ $parameters,
+ $combine,
+ $reserved,
+ false, // Never emit empty strings in multi-param replacements
+ $combine_on_empty
+ );
+ }
+ }
+
+ public function combine(
+ $key,
+ $parameters,
+ $sep,
+ $combine,
+ $reserved,
+ $tag_empty,
+ $combine_on_empty
+ ) {
+ $length = false;
+ $explode = false;
+ $skip_final_combine = false;
+ $value = false;
+
+ // Check for length restriction.
+ if (strpos($key, ":") !== false) {
+ list($key, $length) = explode(":", $key);
+ }
+
+ // Check for explode parameter.
+ if ($key[strlen($key) - 1] == "*") {
+ $explode = true;
+ $key = substr($key, 0, -1);
+ $skip_final_combine = true;
+ }
+
+ // Define the list separator.
+ $list_sep = $explode ? $sep : ",";
+
+ if (isset($parameters[$key])) {
+ $data_type = $this->getDataType($parameters[$key]);
+ switch($data_type) {
+ case self::TYPE_SCALAR:
+ $value = $this->getValue($parameters[$key], $length);
+ break;
+ case self::TYPE_LIST:
+ $values = array();
+ foreach ($parameters[$key] as $pkey => $pvalue) {
+ $pvalue = $this->getValue($pvalue, $length);
+ if ($combine && $explode) {
+ $values[$pkey] = $key . $combine . $pvalue;
+ } else {
+ $values[$pkey] = $pvalue;
+ }
+ }
+ $value = implode($list_sep, $values);
+ if ($value == '') {
+ return '';
+ }
+ break;
+ case self::TYPE_MAP:
+ $values = array();
+ foreach ($parameters[$key] as $pkey => $pvalue) {
+ $pvalue = $this->getValue($pvalue, $length);
+ if ($explode) {
+ $pkey = $this->getValue($pkey, $length);
+ $values[] = $pkey . "=" . $pvalue; // Explode triggers = combine.
+ } else {
+ $values[] = $pkey;
+ $values[] = $pvalue;
+ }
+ }
+ $value = implode($list_sep, $values);
+ if ($value == '') {
+ return false;
+ }
+ break;
+ }
+ } else if ($tag_empty) {
+ // If we are just indicating empty values with their key name, return that.
+ return $key;
+ } else {
+ // Otherwise we can skip this variable due to not being defined.
+ return false;
+ }
+
+ if ($reserved) {
+ $value = str_replace($this->reservedEncoded, $this->reserved, $value);
+ }
+
+ // If we do not need to include the key name, we just return the raw
+ // value.
+ if (!$combine || $skip_final_combine) {
+ return $value;
+ }
+
+ // Else we combine the key name: foo=bar, if value is not the empty string.
+ return $key . ($value != '' || $combine_on_empty ? $combine . $value : '');
+ }
+
+ /**
+ * Return the type of a passed in value
+ */
+ private function getDataType($data)
+ {
+ if (is_array($data)) {
+ reset($data);
+ if (key($data) !== 0) {
+ return self::TYPE_MAP;
+ }
+ return self::TYPE_LIST;
+ }
+ return self::TYPE_SCALAR;
+ }
+
+ /**
+ * Utility function that merges multiple combine calls
+ * for multi-key templates.
+ */
+ private function combineList(
+ $vars,
+ $sep,
+ $parameters,
+ $combine,
+ $reserved,
+ $tag_empty,
+ $combine_on_empty
+ ) {
+ $ret = array();
+ foreach ($vars as $var) {
+ $response = $this->combine(
+ $var,
+ $parameters,
+ $sep,
+ $combine,
+ $reserved,
+ $tag_empty,
+ $combine_on_empty
+ );
+ if ($response === false) {
+ continue;
+ }
+ $ret[] = $response;
+ }
+ return implode($sep, $ret);
+ }
+
+ /**
+ * Utility function to encode and trim values
+ */
+ private function getValue($value, $length)
+ {
+ if ($length) {
+ $value = substr($value, 0, $length);
+ }
+ $value = rawurlencode($value);
+ return $value;
+ }
+}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_Verifier.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Verifier/Abstract.php
index 2839a371df1..e6c9eeb03cc 100644
--- a/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_Verifier.php
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Verifier/Abstract.php
@@ -15,14 +15,13 @@
* limitations under the License.
*/
-require_once "Google_PemVerifier.php";
-
/**
* Verifies signatures.
*
* @author Brian Eaton <beaton@google.com>
*/
-abstract class Google_Verifier {
+abstract class Google_Verifier_Abstract
+{
/**
* Checks a signature, returns true if the signature is correct,
* false otherwise.
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_PemVerifier.php b/apps/files_external/3rdparty/google-api-php-client/src/Google/Verifier/Pem.php
index 6c1c85fa20e..f281575e172 100644
--- a/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_PemVerifier.php
+++ b/apps/files_external/3rdparty/google-api-php-client/src/Google/Verifier/Pem.php
@@ -14,13 +14,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
+require_once 'Google/Auth/Exception.php';
+require_once 'Google/Verifier/Abstract.php';
/**
* Verifies signatures using PEM encoded certificates.
*
* @author Brian Eaton <beaton@google.com>
*/
-class Google_PemVerifier extends Google_Verifier {
+class Google_Verifier_Pem extends Google_Verifier_Abstract
+{
private $publicKey;
/**
@@ -28,20 +32,22 @@ class Google_PemVerifier extends Google_Verifier {
*
* $pem: a PEM encoded certificate (not a file).
* @param $pem
- * @throws Google_AuthException
+ * @throws Google_Auth_Exception
* @throws Google_Exception
*/
- function __construct($pem) {
+ public function __construct($pem)
+ {
if (!function_exists('openssl_x509_read')) {
throw new Google_Exception('Google API PHP client needs the openssl PHP extension');
}
$this->publicKey = openssl_x509_read($pem);
if (!$this->publicKey) {
- throw new Google_AuthException("Unable to parse PEM: $pem");
+ throw new Google_Auth_Exception("Unable to parse PEM: $pem");
}
}
- function __destruct() {
+ public function __destruct()
+ {
if ($this->publicKey) {
openssl_x509_free($this->publicKey);
}
@@ -53,13 +59,15 @@ class Google_PemVerifier extends Google_Verifier {
* Returns true if the signature is valid, false otherwise.
* @param $data
* @param $signature
- * @throws Google_AuthException
+ * @throws Google_Auth_Exception
* @return bool
*/
- function verify($data, $signature) {
- $status = openssl_verify($data, $signature, $this->publicKey, "sha256");
+ public function verify($data, $signature)
+ {
+ $hash = defined("OPENSSL_ALGO_SHA256") ? OPENSSL_ALGO_SHA256 : "sha256";
+ $status = openssl_verify($data, $signature, $this->publicKey, $hash);
if ($status === -1) {
- throw new Google_AuthException('Signature verification error: ' . openssl_error_string());
+ throw new Google_Auth_Exception('Signature verification error: ' . openssl_error_string());
}
return $status === 1;
}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/Google_Client.php b/apps/files_external/3rdparty/google-api-php-client/src/Google_Client.php
deleted file mode 100644
index 498d3a8e9dd..00000000000
--- a/apps/files_external/3rdparty/google-api-php-client/src/Google_Client.php
+++ /dev/null
@@ -1,462 +0,0 @@
-<?php
-/*
- * Copyright 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Check for the required json and curl extensions, the Google APIs PHP Client
-// won't function without them.
-if (! function_exists('curl_init')) {
- throw new Exception('Google PHP API Client requires the CURL PHP extension');
-}
-
-if (! function_exists('json_decode')) {
- throw new Exception('Google PHP API Client requires the JSON PHP extension');
-}
-
-if (! function_exists('http_build_query')) {
- throw new Exception('Google PHP API Client requires http_build_query()');
-}
-
-if (! ini_get('date.timezone') && function_exists('date_default_timezone_set')) {
- date_default_timezone_set('UTC');
-}
-
-// hack around with the include paths a bit so the library 'just works'
-set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path());
-
-require_once "config.php";
-// If a local configuration file is found, merge it's values with the default configuration
-if (file_exists(dirname(__FILE__) . '/local_config.php')) {
- $defaultConfig = $apiConfig;
- require_once (dirname(__FILE__) . '/local_config.php');
- $apiConfig = array_merge($defaultConfig, $apiConfig);
-}
-
-// Include the top level classes, they each include their own dependencies
-require_once 'service/Google_Model.php';
-require_once 'service/Google_Service.php';
-require_once 'service/Google_ServiceResource.php';
-require_once 'auth/Google_AssertionCredentials.php';
-require_once 'auth/Google_Signer.php';
-require_once 'auth/Google_P12Signer.php';
-require_once 'service/Google_BatchRequest.php';
-require_once 'external/URITemplateParser.php';
-require_once 'auth/Google_Auth.php';
-require_once 'cache/Google_Cache.php';
-require_once 'io/Google_IO.php';
-require_once('service/Google_MediaFileUpload.php');
-
-/**
- * The Google API Client
- * http://code.google.com/p/google-api-php-client/
- *
- * @author Chris Chabot <chabotc@google.com>
- * @author Chirag Shah <chirags@google.com>
- */
-class Google_Client {
- /**
- * @static
- * @var Google_Auth $auth
- */
- static $auth;
-
- /**
- * @static
- * @var Google_IO $io
- */
- static $io;
-
- /**
- * @static
- * @var Google_Cache $cache
- */
- static $cache;
-
- /**
- * @static
- * @var boolean $useBatch
- */
- static $useBatch = false;
-
- /** @var array $scopes */
- protected $scopes = array();
-
- /** @var bool $useObjects */
- protected $useObjects = false;
-
- // definitions of services that are discovered.
- protected $services = array();
-
- // Used to track authenticated state, can't discover services after doing authenticate()
- private $authenticated = false;
-
- public function __construct($config = array()) {
- global $apiConfig;
- $apiConfig = array_merge($apiConfig, $config);
- self::$cache = new $apiConfig['cacheClass']();
- self::$auth = new $apiConfig['authClass']();
- self::$io = new $apiConfig['ioClass']();
- }
-
- /**
- * Add a service
- */
- public function addService($service, $version = false) {
- global $apiConfig;
- if ($this->authenticated) {
- throw new Google_Exception('Cant add services after having authenticated');
- }
- $this->services[$service] = array();
- if (isset($apiConfig['services'][$service])) {
- // Merge the service descriptor with the default values
- $this->services[$service] = array_merge($this->services[$service], $apiConfig['services'][$service]);
- }
- }
-
- public function authenticate($code = null) {
- $service = $this->prepareService();
- $this->authenticated = true;
- return self::$auth->authenticate($service, $code);
- }
-
- /**
- * @return array
- * @visible For Testing
- */
- public function prepareService() {
- $service = array();
- $scopes = array();
- if ($this->scopes) {
- $scopes = $this->scopes;
- } else {
- foreach ($this->services as $key => $val) {
- if (isset($val['scope'])) {
- if (is_array($val['scope'])) {
- $scopes = array_merge($val['scope'], $scopes);
- } else {
- $scopes[] = $val['scope'];
- }
- } else {
- $scopes[] = 'https://www.googleapis.com/auth/' . $key;
- }
- unset($val['discoveryURI']);
- unset($val['scope']);
- $service = array_merge($service, $val);
- }
- }
- $service['scope'] = implode(' ', $scopes);
- return $service;
- }
-
- /**
- * Set the OAuth 2.0 access token using the string that resulted from calling authenticate()
- * or Google_Client#getAccessToken().
- * @param string $accessToken JSON encoded string containing in the following format:
- * {"access_token":"TOKEN", "refresh_token":"TOKEN", "token_type":"Bearer",
- * "expires_in":3600, "id_token":"TOKEN", "created":1320790426}
- */
- public function setAccessToken($accessToken) {
- if ($accessToken == null || 'null' == $accessToken) {
- $accessToken = null;
- }
- self::$auth->setAccessToken($accessToken);
- }
-
- /**
- * Set the type of Auth class the client should use.
- * @param string $authClassName
- */
- public function setAuthClass($authClassName) {
- self::$auth = new $authClassName();
- }
-
- /**
- * Construct the OAuth 2.0 authorization request URI.
- * @return string
- */
- public function createAuthUrl() {
- $service = $this->prepareService();
- return self::$auth->createAuthUrl($service['scope']);
- }
-
- /**
- * Get the OAuth 2.0 access token.
- * @return string $accessToken JSON encoded string in the following format:
- * {"access_token":"TOKEN", "refresh_token":"TOKEN", "token_type":"Bearer",
- * "expires_in":3600,"id_token":"TOKEN", "created":1320790426}
- */
- public function getAccessToken() {
- $token = self::$auth->getAccessToken();
- return (null == $token || 'null' == $token) ? null : $token;
- }
-
- /**
- * Returns if the access_token is expired.
- * @return bool Returns True if the access_token is expired.
- */
- public function isAccessTokenExpired() {
- return self::$auth->isAccessTokenExpired();
- }
-
- /**
- * Set the developer key to use, these are obtained through the API Console.
- * @see http://code.google.com/apis/console-help/#generatingdevkeys
- * @param string $developerKey
- */
- public function setDeveloperKey($developerKey) {
- self::$auth->setDeveloperKey($developerKey);
- }
-
- /**
- * Set OAuth 2.0 "state" parameter to achieve per-request customization.
- * @see http://tools.ietf.org/html/draft-ietf-oauth-v2-22#section-3.1.2.2
- * @param string $state
- */
- public function setState($state) {
- self::$auth->setState($state);
- }
-
- /**
- * @param string $accessType Possible values for access_type include:
- * {@code "offline"} to request offline access from the user. (This is the default value)
- * {@code "online"} to request online access from the user.
- */
- public function setAccessType($accessType) {
- self::$auth->setAccessType($accessType);
- }
-
- /**
- * @param string $approvalPrompt Possible values for approval_prompt include:
- * {@code "force"} to force the approval UI to appear. (This is the default value)
- * {@code "auto"} to request auto-approval when possible.
- */
- public function setApprovalPrompt($approvalPrompt) {
- self::$auth->setApprovalPrompt($approvalPrompt);
- }
-
- /**
- * Set the application name, this is included in the User-Agent HTTP header.
- * @param string $applicationName
- */
- public function setApplicationName($applicationName) {
- global $apiConfig;
- $apiConfig['application_name'] = $applicationName;
- }
-
- /**
- * Set the OAuth 2.0 Client ID.
- * @param string $clientId
- */
- public function setClientId($clientId) {
- global $apiConfig;
- $apiConfig['oauth2_client_id'] = $clientId;
- self::$auth->clientId = $clientId;
- }
-
- /**
- * Get the OAuth 2.0 Client ID.
- */
- public function getClientId() {
- return self::$auth->clientId;
- }
-
- /**
- * Set the OAuth 2.0 Client Secret.
- * @param string $clientSecret
- */
- public function setClientSecret($clientSecret) {
- global $apiConfig;
- $apiConfig['oauth2_client_secret'] = $clientSecret;
- self::$auth->clientSecret = $clientSecret;
- }
-
- /**
- * Get the OAuth 2.0 Client Secret.
- */
- public function getClientSecret() {
- return self::$auth->clientSecret;
- }
-
- /**
- * Set the OAuth 2.0 Redirect URI.
- * @param string $redirectUri
- */
- public function setRedirectUri($redirectUri) {
- global $apiConfig;
- $apiConfig['oauth2_redirect_uri'] = $redirectUri;
- self::$auth->redirectUri = $redirectUri;
- }
-
- /**
- * Get the OAuth 2.0 Redirect URI.
- */
- public function getRedirectUri() {
- return self::$auth->redirectUri;
- }
-
- /**
- * Fetches a fresh OAuth 2.0 access token with the given refresh token.
- * @param string $refreshToken
- * @return void
- */
- public function refreshToken($refreshToken) {
- self::$auth->refreshToken($refreshToken);
- }
-
- /**
- * Revoke an OAuth2 access token or refresh token. This method will revoke the current access
- * token, if a token isn't provided.
- * @throws Google_AuthException
- * @param string|null $token The token (access token or a refresh token) that should be revoked.
- * @return boolean Returns True if the revocation was successful, otherwise False.
- */
- public function revokeToken($token = null) {
- self::$auth->revokeToken($token);
- }
-
- /**
- * Verify an id_token. This method will verify the current id_token, if one
- * isn't provided.
- * @throws Google_AuthException
- * @param string|null $token The token (id_token) that should be verified.
- * @return Google_LoginTicket Returns an apiLoginTicket if the verification was
- * successful.
- */
- public function verifyIdToken($token = null) {
- return self::$auth->verifyIdToken($token);
- }
-
- /**
- * @param Google_AssertionCredentials $creds
- * @return void
- */
- public function setAssertionCredentials(Google_AssertionCredentials $creds) {
- self::$auth->setAssertionCredentials($creds);
- }
-
- /**
- * This function allows you to overrule the automatically generated scopes,
- * so that you can ask for more or less permission in the auth flow
- * Set this before you call authenticate() though!
- * @param array $scopes, ie: array('https://www.googleapis.com/auth/plus.me', 'https://www.googleapis.com/auth/moderator')
- */
- public function setScopes($scopes) {
- $this->scopes = is_string($scopes) ? explode(" ", $scopes) : $scopes;
- }
-
- /**
- * Returns the list of scopes set on the client
- * @return array the list of scopes
- *
- */
- public function getScopes() {
- return $this->scopes;
- }
-
- /**
- * Declare if objects should be returned by the api service classes.
- *
- * @param boolean $useObjects True if objects should be returned by the service classes.
- * False if associative arrays should be returned (default behavior).
- * @experimental
- */
- public function setUseObjects($useObjects) {
- global $apiConfig;
- $apiConfig['use_objects'] = $useObjects;
- }
-
- /**
- * Declare if objects should be returned by the api service classes.
- *
- * @param boolean $useBatch True if the experimental batch support should
- * be enabled. Defaults to False.
- * @experimental
- */
- public function setUseBatch($useBatch) {
- self::$useBatch = $useBatch;
- }
-
- /**
- * @static
- * @return Google_Auth the implementation of apiAuth.
- */
- public static function getAuth() {
- return Google_Client::$auth;
- }
-
- /**
- * @static
- * @return Google_IO the implementation of apiIo.
- */
- public static function getIo() {
- return Google_Client::$io;
- }
-
- /**
- * @return Google_Cache the implementation of apiCache.
- */
- public function getCache() {
- return Google_Client::$cache;
- }
-}
-
-// Exceptions that the Google PHP API Library can throw
-class Google_Exception extends Exception {}
-class Google_AuthException extends Google_Exception {}
-class Google_CacheException extends Google_Exception {}
-class Google_IOException extends Google_Exception {}
-class Google_ServiceException extends Google_Exception {
- /**
- * Optional list of errors returned in a JSON body of an HTTP error response.
- */
- protected $errors = array();
-
- /**
- * Override default constructor to add ability to set $errors.
- *
- * @param string $message
- * @param int $code
- * @param Exception|null $previous
- * @param [{string, string}] errors List of errors returned in an HTTP
- * response. Defaults to [].
- */
- public function __construct($message, $code = 0, Exception $previous = null,
- $errors = array()) {
- if(version_compare(PHP_VERSION, '5.3.0') >= 0) {
- parent::__construct($message, $code, $previous);
- } else {
- parent::__construct($message, $code);
- }
-
- $this->errors = $errors;
- }
-
- /**
- * An example of the possible errors returned.
- *
- * {
- * "domain": "global",
- * "reason": "authError",
- * "message": "Invalid Credentials",
- * "locationType": "header",
- * "location": "Authorization",
- * }
- *
- * @return [{string, string}] List of errors return in an HTTP response or [].
- */
- public function getErrors() {
- return $this->errors;
- }
-}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_AuthNone.php b/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_AuthNone.php
deleted file mode 100644
index 6ca6bc2b0db..00000000000
--- a/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_AuthNone.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-/*
- * Copyright 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Do-nothing authentication implementation, use this if you want to make un-authenticated calls
- * @author Chris Chabot <chabotc@google.com>
- * @author Chirag Shah <chirags@google.com>
- */
-class Google_AuthNone extends Google_Auth {
- public $key = null;
-
- public function __construct() {
- global $apiConfig;
- if (!empty($apiConfig['developer_key'])) {
- $this->setDeveloperKey($apiConfig['developer_key']);
- }
- }
-
- public function setDeveloperKey($key) {$this->key = $key;}
- public function authenticate($service) {/*noop*/}
- public function setAccessToken($accessToken) {/* noop*/}
- public function getAccessToken() {return null;}
- public function createAuthUrl($scope) {return null;}
- public function refreshToken($refreshToken) {/* noop*/}
- public function revokeToken() {/* noop*/}
-
- public function sign(Google_HttpRequest $request) {
- if ($this->key) {
- $request->setUrl($request->getUrl() . ((strpos($request->getUrl(), '?') === false) ? '?' : '&')
- . 'key='.urlencode($this->key));
- }
- return $request;
- }
-}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_OAuth2.php b/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_OAuth2.php
deleted file mode 100644
index a07d4365a7a..00000000000
--- a/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_OAuth2.php
+++ /dev/null
@@ -1,445 +0,0 @@
-<?php
-/*
- * Copyright 2008 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-require_once "Google_Verifier.php";
-require_once "Google_LoginTicket.php";
-require_once "service/Google_Utils.php";
-
-/**
- * Authentication class that deals with the OAuth 2 web-server authentication flow
- *
- * @author Chris Chabot <chabotc@google.com>
- * @author Chirag Shah <chirags@google.com>
- *
- */
-class Google_OAuth2 extends Google_Auth {
- public $clientId;
- public $clientSecret;
- public $developerKey;
- public $token;
- public $redirectUri;
- public $state;
- public $accessType = 'offline';
- public $approvalPrompt = 'force';
-
- /** @var Google_AssertionCredentials $assertionCredentials */
- public $assertionCredentials;
-
- const OAUTH2_REVOKE_URI = 'https://accounts.google.com/o/oauth2/revoke';
- const OAUTH2_TOKEN_URI = 'https://accounts.google.com/o/oauth2/token';
- const OAUTH2_AUTH_URL = 'https://accounts.google.com/o/oauth2/auth';
- const OAUTH2_FEDERATED_SIGNON_CERTS_URL = 'https://www.googleapis.com/oauth2/v1/certs';
- const CLOCK_SKEW_SECS = 300; // five minutes in seconds
- const AUTH_TOKEN_LIFETIME_SECS = 300; // five minutes in seconds
- const MAX_TOKEN_LIFETIME_SECS = 86400; // one day in seconds
-
- /**
- * Instantiates the class, but does not initiate the login flow, leaving it
- * to the discretion of the caller (which is done by calling authenticate()).
- */
- public function __construct() {
- global $apiConfig;
-
- if (! empty($apiConfig['developer_key'])) {
- $this->developerKey = $apiConfig['developer_key'];
- }
-
- if (! empty($apiConfig['oauth2_client_id'])) {
- $this->clientId = $apiConfig['oauth2_client_id'];
- }
-
- if (! empty($apiConfig['oauth2_client_secret'])) {
- $this->clientSecret = $apiConfig['oauth2_client_secret'];
- }
-
- if (! empty($apiConfig['oauth2_redirect_uri'])) {
- $this->redirectUri = $apiConfig['oauth2_redirect_uri'];
- }
-
- if (! empty($apiConfig['oauth2_access_type'])) {
- $this->accessType = $apiConfig['oauth2_access_type'];
- }
-
- if (! empty($apiConfig['oauth2_approval_prompt'])) {
- $this->approvalPrompt = $apiConfig['oauth2_approval_prompt'];
- }
-
- }
-
- /**
- * @param $service
- * @param string|null $code
- * @throws Google_AuthException
- * @return string
- */
- public function authenticate($service, $code = null) {
- if (!$code && isset($_GET['code'])) {
- $code = $_GET['code'];
- }
-
- if ($code) {
- // We got here from the redirect from a successful authorization grant, fetch the access token
- $request = Google_Client::$io->makeRequest(new Google_HttpRequest(self::OAUTH2_TOKEN_URI, 'POST', array(), array(
- 'code' => $code,
- 'grant_type' => 'authorization_code',
- 'redirect_uri' => $this->redirectUri,
- 'client_id' => $this->clientId,
- 'client_secret' => $this->clientSecret
- )));
-
- if ($request->getResponseHttpCode() == 200) {
- $this->setAccessToken($request->getResponseBody());
- $this->token['created'] = time();
- return $this->getAccessToken();
- } else {
- $response = $request->getResponseBody();
- $decodedResponse = json_decode($response, true);
- if ($decodedResponse != null && $decodedResponse['error']) {
- $response = $decodedResponse['error'];
- }
- throw new Google_AuthException("Error fetching OAuth2 access token, message: '$response'", $request->getResponseHttpCode());
- }
- }
-
- $authUrl = $this->createAuthUrl($service['scope']);
- header('Location: ' . $authUrl);
- return true;
- }
-
- /**
- * Create a URL to obtain user authorization.
- * The authorization endpoint allows the user to first
- * authenticate, and then grant/deny the access request.
- * @param string $scope The scope is expressed as a list of space-delimited strings.
- * @return string
- */
- public function createAuthUrl($scope) {
- $params = array(
- 'response_type=code',
- 'redirect_uri=' . urlencode($this->redirectUri),
- 'client_id=' . urlencode($this->clientId),
- 'scope=' . urlencode($scope),
- 'access_type=' . urlencode($this->accessType),
- 'approval_prompt=' . urlencode($this->approvalPrompt),
- );
-
- if (isset($this->state)) {
- $params[] = 'state=' . urlencode($this->state);
- }
- $params = implode('&', $params);
- return self::OAUTH2_AUTH_URL . "?$params";
- }
-
- /**
- * @param string $token
- * @throws Google_AuthException
- */
- public function setAccessToken($token) {
- $token = json_decode($token, true);
- if ($token == null) {
- throw new Google_AuthException('Could not json decode the token');
- }
- if (! isset($token['access_token'])) {
- throw new Google_AuthException("Invalid token format");
- }
- $this->token = $token;
- }
-
- public function getAccessToken() {
- return json_encode($this->token);
- }
-
- public function setDeveloperKey($developerKey) {
- $this->developerKey = $developerKey;
- }
-
- public function setState($state) {
- $this->state = $state;
- }
-
- public function setAccessType($accessType) {
- $this->accessType = $accessType;
- }
-
- public function setApprovalPrompt($approvalPrompt) {
- $this->approvalPrompt = $approvalPrompt;
- }
-
- public function setAssertionCredentials(Google_AssertionCredentials $creds) {
- $this->assertionCredentials = $creds;
- }
-
- /**
- * Include an accessToken in a given apiHttpRequest.
- * @param Google_HttpRequest $request
- * @return Google_HttpRequest
- * @throws Google_AuthException
- */
- public function sign(Google_HttpRequest $request) {
- // add the developer key to the request before signing it
- if ($this->developerKey) {
- $requestUrl = $request->getUrl();
- $requestUrl .= (strpos($request->getUrl(), '?') === false) ? '?' : '&';
- $requestUrl .= 'key=' . urlencode($this->developerKey);
- $request->setUrl($requestUrl);
- }
-
- // Cannot sign the request without an OAuth access token.
- if (null == $this->token && null == $this->assertionCredentials) {
- return $request;
- }
-
- // Check if the token is set to expire in the next 30 seconds
- // (or has already expired).
- if ($this->isAccessTokenExpired()) {
- if ($this->assertionCredentials) {
- $this->refreshTokenWithAssertion();
- } else {
- if (! array_key_exists('refresh_token', $this->token)) {
- throw new Google_AuthException("The OAuth 2.0 access token has expired, "
- . "and a refresh token is not available. Refresh tokens are not "
- . "returned for responses that were auto-approved.");
- }
- $this->refreshToken($this->token['refresh_token']);
- }
- }
-
- // Add the OAuth2 header to the request
- $request->setRequestHeaders(
- array('Authorization' => 'Bearer ' . $this->token['access_token'])
- );
-
- return $request;
- }
-
- /**
- * Fetches a fresh access token with the given refresh token.
- * @param string $refreshToken
- * @return void
- */
- public function refreshToken($refreshToken) {
- $this->refreshTokenRequest(array(
- 'client_id' => $this->clientId,
- 'client_secret' => $this->clientSecret,
- 'refresh_token' => $refreshToken,
- 'grant_type' => 'refresh_token'
- ));
- }
-
- /**
- * Fetches a fresh access token with a given assertion token.
- * @param Google_AssertionCredentials $assertionCredentials optional.
- * @return void
- */
- public function refreshTokenWithAssertion($assertionCredentials = null) {
- if (!$assertionCredentials) {
- $assertionCredentials = $this->assertionCredentials;
- }
-
- $this->refreshTokenRequest(array(
- 'grant_type' => 'assertion',
- 'assertion_type' => $assertionCredentials->assertionType,
- 'assertion' => $assertionCredentials->generateAssertion(),
- ));
- }
-
- private function refreshTokenRequest($params) {
- $http = new Google_HttpRequest(self::OAUTH2_TOKEN_URI, 'POST', array(), $params);
- $request = Google_Client::$io->makeRequest($http);
-
- $code = $request->getResponseHttpCode();
- $body = $request->getResponseBody();
- if (200 == $code) {
- $token = json_decode($body, true);
- if ($token == null) {
- throw new Google_AuthException("Could not json decode the access token");
- }
-
- if (! isset($token['access_token']) || ! isset($token['expires_in'])) {
- throw new Google_AuthException("Invalid token format");
- }
-
- $this->token['access_token'] = $token['access_token'];
- $this->token['expires_in'] = $token['expires_in'];
- $this->token['created'] = time();
- } else {
- throw new Google_AuthException("Error refreshing the OAuth2 token, message: '$body'", $code);
- }
- }
-
- /**
- * Revoke an OAuth2 access token or refresh token. This method will revoke the current access
- * token, if a token isn't provided.
- * @throws Google_AuthException
- * @param string|null $token The token (access token or a refresh token) that should be revoked.
- * @return boolean Returns True if the revocation was successful, otherwise False.
- */
- public function revokeToken($token = null) {
- if (!$token) {
- $token = $this->token['access_token'];
- }
- $request = new Google_HttpRequest(self::OAUTH2_REVOKE_URI, 'POST', array(), "token=$token");
- $response = Google_Client::$io->makeRequest($request);
- $code = $response->getResponseHttpCode();
- if ($code == 200) {
- $this->token = null;
- return true;
- }
-
- return false;
- }
-
- /**
- * Returns if the access_token is expired.
- * @return bool Returns True if the access_token is expired.
- */
- public function isAccessTokenExpired() {
- if (null == $this->token) {
- return true;
- }
-
- // If the token is set to expire in the next 30 seconds.
- $expired = ($this->token['created']
- + ($this->token['expires_in'] - 30)) < time();
-
- return $expired;
- }
-
- // Gets federated sign-on certificates to use for verifying identity tokens.
- // Returns certs as array structure, where keys are key ids, and values
- // are PEM encoded certificates.
- private function getFederatedSignOnCerts() {
- // This relies on makeRequest caching certificate responses.
- $request = Google_Client::$io->makeRequest(new Google_HttpRequest(
- self::OAUTH2_FEDERATED_SIGNON_CERTS_URL));
- if ($request->getResponseHttpCode() == 200) {
- $certs = json_decode($request->getResponseBody(), true);
- if ($certs) {
- return $certs;
- }
- }
- throw new Google_AuthException(
- "Failed to retrieve verification certificates: '" .
- $request->getResponseBody() . "'.",
- $request->getResponseHttpCode());
- }
-
- /**
- * Verifies an id token and returns the authenticated apiLoginTicket.
- * Throws an exception if the id token is not valid.
- * The audience parameter can be used to control which id tokens are
- * accepted. By default, the id token must have been issued to this OAuth2 client.
- *
- * @param $id_token
- * @param $audience
- * @return Google_LoginTicket
- */
- public function verifyIdToken($id_token = null, $audience = null) {
- if (!$id_token) {
- $id_token = $this->token['id_token'];
- }
-
- $certs = $this->getFederatedSignonCerts();
- if (!$audience) {
- $audience = $this->clientId;
- }
- return $this->verifySignedJwtWithCerts($id_token, $certs, $audience);
- }
-
- // Verifies the id token, returns the verified token contents.
- // Visible for testing.
- function verifySignedJwtWithCerts($jwt, $certs, $required_audience) {
- $segments = explode(".", $jwt);
- if (count($segments) != 3) {
- throw new Google_AuthException("Wrong number of segments in token: $jwt");
- }
- $signed = $segments[0] . "." . $segments[1];
- $signature = Google_Utils::urlSafeB64Decode($segments[2]);
-
- // Parse envelope.
- $envelope = json_decode(Google_Utils::urlSafeB64Decode($segments[0]), true);
- if (!$envelope) {
- throw new Google_AuthException("Can't parse token envelope: " . $segments[0]);
- }
-
- // Parse token
- $json_body = Google_Utils::urlSafeB64Decode($segments[1]);
- $payload = json_decode($json_body, true);
- if (!$payload) {
- throw new Google_AuthException("Can't parse token payload: " . $segments[1]);
- }
-
- // Check signature
- $verified = false;
- foreach ($certs as $keyName => $pem) {
- $public_key = new Google_PemVerifier($pem);
- if ($public_key->verify($signed, $signature)) {
- $verified = true;
- break;
- }
- }
-
- if (!$verified) {
- throw new Google_AuthException("Invalid token signature: $jwt");
- }
-
- // Check issued-at timestamp
- $iat = 0;
- if (array_key_exists("iat", $payload)) {
- $iat = $payload["iat"];
- }
- if (!$iat) {
- throw new Google_AuthException("No issue time in token: $json_body");
- }
- $earliest = $iat - self::CLOCK_SKEW_SECS;
-
- // Check expiration timestamp
- $now = time();
- $exp = 0;
- if (array_key_exists("exp", $payload)) {
- $exp = $payload["exp"];
- }
- if (!$exp) {
- throw new Google_AuthException("No expiration time in token: $json_body");
- }
- if ($exp >= $now + self::MAX_TOKEN_LIFETIME_SECS) {
- throw new Google_AuthException(
- "Expiration time too far in future: $json_body");
- }
-
- $latest = $exp + self::CLOCK_SKEW_SECS;
- if ($now < $earliest) {
- throw new Google_AuthException(
- "Token used too early, $now < $earliest: $json_body");
- }
- if ($now > $latest) {
- throw new Google_AuthException(
- "Token used too late, $now > $latest: $json_body");
- }
-
- // TODO(beaton): check issuer field?
-
- // Check audience
- $aud = $payload["aud"];
- if ($aud != $required_audience) {
- throw new Google_AuthException("Wrong recipient, $aud != $required_audience: $json_body");
- }
-
- // All good.
- return new Google_LoginTicket($envelope, $payload);
- }
-}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_P12Signer.php b/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_P12Signer.php
deleted file mode 100644
index 1bed5909913..00000000000
--- a/apps/files_external/3rdparty/google-api-php-client/src/auth/Google_P12Signer.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-/*
- * Copyright 2011 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Signs data.
- *
- * Only used for testing.
- *
- * @author Brian Eaton <beaton@google.com>
- */
-class Google_P12Signer extends Google_Signer {
- // OpenSSL private key resource
- private $privateKey;
-
- // Creates a new signer from a .p12 file.
- function __construct($p12, $password) {
- if (!function_exists('openssl_x509_read')) {
- throw new Exception(
- 'The Google PHP API library needs the openssl PHP extension');
- }
-
- // This throws on error
- $certs = array();
- if (!openssl_pkcs12_read($p12, $certs, $password)) {
- throw new Google_AuthException("Unable to parse the p12 file. " .
- "Is this a .p12 file? Is the password correct? OpenSSL error: " .
- openssl_error_string());
- }
- // TODO(beaton): is this part of the contract for the openssl_pkcs12_read
- // method? What happens if there are multiple private keys? Do we care?
- if (!array_key_exists("pkey", $certs) || !$certs["pkey"]) {
- throw new Google_AuthException("No private key found in p12 file.");
- }
- $this->privateKey = openssl_pkey_get_private($certs["pkey"]);
- if (!$this->privateKey) {
- throw new Google_AuthException("Unable to load private key in ");
- }
- }
-
- function __destruct() {
- if ($this->privateKey) {
- openssl_pkey_free($this->privateKey);
- }
- }
-
- function sign($data) {
- if(version_compare(PHP_VERSION, '5.3.0') < 0) {
- throw new Google_AuthException(
- "PHP 5.3.0 or higher is required to use service accounts.");
- }
- if (!openssl_sign($data, $signature, $this->privateKey, "sha256")) {
- throw new Google_AuthException("Unable to sign data");
- }
- return $signature;
- }
-}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/cache/Google_ApcCache.php b/apps/files_external/3rdparty/google-api-php-client/src/cache/Google_ApcCache.php
deleted file mode 100644
index 3523c98dcca..00000000000
--- a/apps/files_external/3rdparty/google-api-php-client/src/cache/Google_ApcCache.php
+++ /dev/null
@@ -1,98 +0,0 @@
-<?php
-/*
- * Copyright 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * A persistent storage class based on the APC cache, which is not
- * really very persistent, as soon as you restart your web server
- * the storage will be wiped, however for debugging and/or speed
- * it can be useful, kinda, and cache is a lot cheaper then storage.
- *
- * @author Chris Chabot <chabotc@google.com>
- */
-class googleApcCache extends Google_Cache {
-
- public function __construct() {
- if (! function_exists('apc_add')) {
- throw new Google_CacheException("Apc functions not available");
- }
- }
-
- private function isLocked($key) {
- if ((@apc_fetch($key . '.lock')) === false) {
- return false;
- }
- return true;
- }
-
- private function createLock($key) {
- // the interesting thing is that this could fail if the lock was created in the meantime..
- // but we'll ignore that out of convenience
- @apc_add($key . '.lock', '', 5);
- }
-
- private function removeLock($key) {
- // suppress all warnings, if some other process removed it that's ok too
- @apc_delete($key . '.lock');
- }
-
- private function waitForLock($key) {
- // 20 x 250 = 5 seconds
- $tries = 20;
- $cnt = 0;
- do {
- // 250 ms is a long time to sleep, but it does stop the server from burning all resources on polling locks..
- usleep(250);
- $cnt ++;
- } while ($cnt <= $tries && $this->isLocked($key));
- if ($this->isLocked($key)) {
- // 5 seconds passed, assume the owning process died off and remove it
- $this->removeLock($key);
- }
- }
-
- /**
- * @inheritDoc
- */
- public function get($key, $expiration = false) {
-
- if (($ret = @apc_fetch($key)) === false) {
- return false;
- }
- if (!$expiration || (time() - $ret['time'] > $expiration)) {
- $this->delete($key);
- return false;
- }
- return unserialize($ret['data']);
- }
-
- /**
- * @inheritDoc
- */
- public function set($key, $value) {
- if (@apc_store($key, array('time' => time(), 'data' => serialize($value))) == false) {
- throw new Google_CacheException("Couldn't store data");
- }
- }
-
- /**
- * @inheritDoc
- * @param String $key
- */
- public function delete($key) {
- @apc_delete($key);
- }
-}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/cache/Google_FileCache.php b/apps/files_external/3rdparty/google-api-php-client/src/cache/Google_FileCache.php
deleted file mode 100644
index 1e32859a48b..00000000000
--- a/apps/files_external/3rdparty/google-api-php-client/src/cache/Google_FileCache.php
+++ /dev/null
@@ -1,137 +0,0 @@
-<?php
-/*
- * Copyright 2008 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * This class implements a basic on disk storage. While that does
- * work quite well it's not the most elegant and scalable solution.
- * It will also get you into a heap of trouble when you try to run
- * this in a clustered environment. In those cases please use the
- * MySql back-end
- *
- * @author Chris Chabot <chabotc@google.com>
- */
-class Google_FileCache extends Google_Cache {
- private $path;
-
- public function __construct() {
- global $apiConfig;
- $this->path = $apiConfig['ioFileCache_directory'];
- }
-
- private function isLocked($storageFile) {
- // our lock file convention is simple: /the/file/path.lock
- return file_exists($storageFile . '.lock');
- }
-
- private function createLock($storageFile) {
- $storageDir = dirname($storageFile);
- if (! is_dir($storageDir)) {
- // @codeCoverageIgnoreStart
- if (! @mkdir($storageDir, 0755, true)) {
- // make sure the failure isn't because of a concurrency issue
- if (! is_dir($storageDir)) {
- throw new Google_CacheException("Could not create storage directory: $storageDir");
- }
- }
- // @codeCoverageIgnoreEnd
- }
- @touch($storageFile . '.lock');
- }
-
- private function removeLock($storageFile) {
- // suppress all warnings, if some other process removed it that's ok too
- @unlink($storageFile . '.lock');
- }
-
- private function waitForLock($storageFile) {
- // 20 x 250 = 5 seconds
- $tries = 20;
- $cnt = 0;
- do {
- // make sure PHP picks up on file changes. This is an expensive action but really can't be avoided
- clearstatcache();
- // 250 ms is a long time to sleep, but it does stop the server from burning all resources on polling locks..
- usleep(250);
- $cnt ++;
- } while ($cnt <= $tries && $this->isLocked($storageFile));
- if ($this->isLocked($storageFile)) {
- // 5 seconds passed, assume the owning process died off and remove it
- $this->removeLock($storageFile);
- }
- }
-
- private function getCacheDir($hash) {
- // use the first 2 characters of the hash as a directory prefix
- // this should prevent slowdowns due to huge directory listings
- // and thus give some basic amount of scalability
- return $this->path . '/' . substr($hash, 0, 2);
- }
-
- private function getCacheFile($hash) {
- return $this->getCacheDir($hash) . '/' . $hash;
- }
-
- public function get($key, $expiration = false) {
- $storageFile = $this->getCacheFile(md5($key));
- // See if this storage file is locked, if so we wait up to 5 seconds for the lock owning process to
- // complete it's work. If the lock is not released within that time frame, it's cleaned up.
- // This should give us a fair amount of 'Cache Stampeding' protection
- if ($this->isLocked($storageFile)) {
- $this->waitForLock($storageFile);
- }
- if (file_exists($storageFile) && is_readable($storageFile)) {
- $now = time();
- if (! $expiration || (($mtime = @filemtime($storageFile)) !== false && ($now - $mtime) < $expiration)) {
- if (($data = @file_get_contents($storageFile)) !== false) {
- $data = unserialize($data);
- return $data;
- }
- }
- }
- return false;
- }
-
- public function set($key, $value) {
- $storageDir = $this->getCacheDir(md5($key));
- $storageFile = $this->getCacheFile(md5($key));
- if ($this->isLocked($storageFile)) {
- // some other process is writing to this file too, wait until it's done to prevent hiccups
- $this->waitForLock($storageFile);
- }
- if (! is_dir($storageDir)) {
- if (! @mkdir($storageDir, 0755, true)) {
- throw new Google_CacheException("Could not create storage directory: $storageDir");
- }
- }
- // we serialize the whole request object, since we don't only want the
- // responseContent but also the postBody used, headers, size, etc
- $data = serialize($value);
- $this->createLock($storageFile);
- if (! @file_put_contents($storageFile, $data)) {
- $this->removeLock($storageFile);
- throw new Google_CacheException("Could not store data in the file");
- }
- $this->removeLock($storageFile);
- }
-
- public function delete($key) {
- $file = $this->getCacheFile(md5($key));
- if (! @unlink($file)) {
- throw new Google_CacheException("Cache file could not be deleted");
- }
- }
-}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/cache/Google_MemcacheCache.php b/apps/files_external/3rdparty/google-api-php-client/src/cache/Google_MemcacheCache.php
deleted file mode 100644
index 22493f8b1ec..00000000000
--- a/apps/files_external/3rdparty/google-api-php-client/src/cache/Google_MemcacheCache.php
+++ /dev/null
@@ -1,130 +0,0 @@
-<?php
-/*
- * Copyright 2008 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * A persistent storage class based on the memcache, which is not
- * really very persistent, as soon as you restart your memcache daemon
- * the storage will be wiped, however for debugging and/or speed
- * it can be useful, kinda, and cache is a lot cheaper then storage.
- *
- * @author Chris Chabot <chabotc@google.com>
- */
-class Google_MemcacheCache extends Google_Cache {
- private $connection = false;
-
- public function __construct() {
- global $apiConfig;
- if (! function_exists('memcache_connect')) {
- throw new Google_CacheException("Memcache functions not available");
- }
- $this->host = $apiConfig['ioMemCacheCache_host'];
- $this->port = $apiConfig['ioMemCacheCache_port'];
- if (empty($this->host) || empty($this->port)) {
- throw new Google_CacheException("You need to supply a valid memcache host and port");
- }
- }
-
- private function isLocked($key) {
- $this->check();
- if ((@memcache_get($this->connection, $key . '.lock')) === false) {
- return false;
- }
- return true;
- }
-
- private function createLock($key) {
- $this->check();
- // the interesting thing is that this could fail if the lock was created in the meantime..
- // but we'll ignore that out of convenience
- @memcache_add($this->connection, $key . '.lock', '', 0, 5);
- }
-
- private function removeLock($key) {
- $this->check();
- // suppress all warnings, if some other process removed it that's ok too
- @memcache_delete($this->connection, $key . '.lock');
- }
-
- private function waitForLock($key) {
- $this->check();
- // 20 x 250 = 5 seconds
- $tries = 20;
- $cnt = 0;
- do {
- // 250 ms is a long time to sleep, but it does stop the server from burning all resources on polling locks..
- usleep(250);
- $cnt ++;
- } while ($cnt <= $tries && $this->isLocked($key));
- if ($this->isLocked($key)) {
- // 5 seconds passed, assume the owning process died off and remove it
- $this->removeLock($key);
- }
- }
-
- // I prefer lazy initialization since the cache isn't used every request
- // so this potentially saves a lot of overhead
- private function connect() {
- if (! $this->connection = @memcache_pconnect($this->host, $this->port)) {
- throw new Google_CacheException("Couldn't connect to memcache server");
- }
- }
-
- private function check() {
- if (! $this->connection) {
- $this->connect();
- }
- }
-
- /**
- * @inheritDoc
- */
- public function get($key, $expiration = false) {
- $this->check();
- if (($ret = @memcache_get($this->connection, $key)) === false) {
- return false;
- }
- if (! $expiration || (time() - $ret['time'] > $expiration)) {
- $this->delete($key);
- return false;
- }
- return $ret['data'];
- }
-
- /**
- * @inheritDoc
- * @param string $key
- * @param string $value
- * @throws Google_CacheException
- */
- public function set($key, $value) {
- $this->check();
- // we store it with the cache_time default expiration so objects will at least get cleaned eventually.
- if (@memcache_set($this->connection, $key, array('time' => time(),
- 'data' => $value), false) == false) {
- throw new Google_CacheException("Couldn't store data in cache");
- }
- }
-
- /**
- * @inheritDoc
- * @param String $key
- */
- public function delete($key) {
- $this->check();
- @memcache_delete($this->connection, $key);
- }
-}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/config.php b/apps/files_external/3rdparty/google-api-php-client/src/config.php
deleted file mode 100644
index e3a57138d05..00000000000
--- a/apps/files_external/3rdparty/google-api-php-client/src/config.php
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-/*
- * Copyright 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-global $apiConfig;
-$apiConfig = array(
- // True if objects should be returned by the service classes.
- // False if associative arrays should be returned (default behavior).
- 'use_objects' => false,
-
- // The application_name is included in the User-Agent HTTP header.
- 'application_name' => '',
-
- // OAuth2 Settings, you can get these keys at https://code.google.com/apis/console
- 'oauth2_client_id' => '',
- 'oauth2_client_secret' => '',
- 'oauth2_redirect_uri' => '',
-
- // The developer key, you get this at https://code.google.com/apis/console
- 'developer_key' => '',
-
- // Site name to show in the Google's OAuth 1 authentication screen.
- 'site_name' => 'www.example.org',
-
- // Which Authentication, Storage and HTTP IO classes to use.
- 'authClass' => 'Google_OAuth2',
- 'ioClass' => 'Google_CurlIO',
- 'cacheClass' => 'Google_FileCache',
-
- // Don't change these unless you're working against a special development or testing environment.
- 'basePath' => 'https://www.googleapis.com',
-
- // IO Class dependent configuration, you only have to configure the values
- // for the class that was configured as the ioClass above
- 'ioFileCache_directory' =>
- (function_exists('sys_get_temp_dir') ?
- sys_get_temp_dir() . '/Google_Client' :
- '/tmp/Google_Client'),
-
- // Definition of service specific values like scopes, oauth token URLs, etc
- 'services' => array(
- 'analytics' => array('scope' => 'https://www.googleapis.com/auth/analytics.readonly'),
- 'calendar' => array(
- 'scope' => array(
- "https://www.googleapis.com/auth/calendar",
- "https://www.googleapis.com/auth/calendar.readonly",
- )
- ),
- 'books' => array('scope' => 'https://www.googleapis.com/auth/books'),
- 'latitude' => array(
- 'scope' => array(
- 'https://www.googleapis.com/auth/latitude.all.best',
- 'https://www.googleapis.com/auth/latitude.all.city',
- )
- ),
- 'moderator' => array('scope' => 'https://www.googleapis.com/auth/moderator'),
- 'oauth2' => array(
- 'scope' => array(
- 'https://www.googleapis.com/auth/userinfo.profile',
- 'https://www.googleapis.com/auth/userinfo.email',
- )
- ),
- 'plus' => array('scope' => 'https://www.googleapis.com/auth/plus.login'),
- 'siteVerification' => array('scope' => 'https://www.googleapis.com/auth/siteverification'),
- 'tasks' => array('scope' => 'https://www.googleapis.com/auth/tasks'),
- 'urlshortener' => array('scope' => 'https://www.googleapis.com/auth/urlshortener')
- )
-);
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/contrib/Google_DriveService.php b/apps/files_external/3rdparty/google-api-php-client/src/contrib/Google_DriveService.php
deleted file mode 100644
index 896e8b93826..00000000000
--- a/apps/files_external/3rdparty/google-api-php-client/src/contrib/Google_DriveService.php
+++ /dev/null
@@ -1,3143 +0,0 @@
-<?php
-/*
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-
- /**
- * The "about" collection of methods.
- * Typical usage is:
- * <code>
- * $driveService = new Google_DriveService(...);
- * $about = $driveService->about;
- * </code>
- */
- class Google_AboutServiceResource extends Google_ServiceResource {
-
-
- /**
- * Gets the information about the current user along with Drive API settings (about.get)
- *
- * @param array $optParams Optional parameters.
- *
- * @opt_param bool includeSubscribed When calculating the number of remaining change IDs, whether to include shared files and public files the user has opened. When set to false, this counts only change IDs for owned files and any shared or public files that the user has explictly added to a folder in Drive.
- * @opt_param string maxChangeIdCount Maximum number of remaining change IDs to count
- * @opt_param string startChangeId Change ID to start counting from when calculating number of remaining change IDs
- * @return Google_About
- */
- public function get($optParams = array()) {
- $params = array();
- $params = array_merge($params, $optParams);
- $data = $this->__call('get', array($params));
- if ($this->useObjects()) {
- return new Google_About($data);
- } else {
- return $data;
- }
- }
- }
-
- /**
- * The "apps" collection of methods.
- * Typical usage is:
- * <code>
- * $driveService = new Google_DriveService(...);
- * $apps = $driveService->apps;
- * </code>
- */
- class Google_AppsServiceResource extends Google_ServiceResource {
-
-
- /**
- * Gets a specific app. (apps.get)
- *
- * @param string $appId The ID of the app.
- * @param array $optParams Optional parameters.
- * @return Google_App
- */
- public function get($appId, $optParams = array()) {
- $params = array('appId' => $appId);
- $params = array_merge($params, $optParams);
- $data = $this->__call('get', array($params));
- if ($this->useObjects()) {
- return new Google_App($data);
- } else {
- return $data;
- }
- }
- /**
- * Lists a user's installed apps. (apps.list)
- *
- * @param array $optParams Optional parameters.
- * @return Google_AppList
- */
- public function listApps($optParams = array()) {
- $params = array();
- $params = array_merge($params, $optParams);
- $data = $this->__call('list', array($params));
- if ($this->useObjects()) {
- return new Google_AppList($data);
- } else {
- return $data;
- }
- }
- }
-
- /**
- * The "changes" collection of methods.
- * Typical usage is:
- * <code>
- * $driveService = new Google_DriveService(...);
- * $changes = $driveService->changes;
- * </code>
- */
- class Google_ChangesServiceResource extends Google_ServiceResource {
-
-
- /**
- * Gets a specific change. (changes.get)
- *
- * @param string $changeId The ID of the change.
- * @param array $optParams Optional parameters.
- * @return Google_Change
- */
- public function get($changeId, $optParams = array()) {
- $params = array('changeId' => $changeId);
- $params = array_merge($params, $optParams);
- $data = $this->__call('get', array($params));
- if ($this->useObjects()) {
- return new Google_Change($data);
- } else {
- return $data;
- }
- }
- /**
- * Lists the changes for a user. (changes.list)
- *
- * @param array $optParams Optional parameters.
- *
- * @opt_param bool includeDeleted Whether to include deleted items.
- * @opt_param bool includeSubscribed Whether to include shared files and public files the user has opened. When set to false, the list will include owned files plus any shared or public files the user has explictly added to a folder in Drive.
- * @opt_param int maxResults Maximum number of changes to return.
- * @opt_param string pageToken Page token for changes.
- * @opt_param string startChangeId Change ID to start listing changes from.
- * @return Google_ChangeList
- */
- public function listChanges($optParams = array()) {
- $params = array();
- $params = array_merge($params, $optParams);
- $data = $this->__call('list', array($params));
- if ($this->useObjects()) {
- return new Google_ChangeList($data);
- } else {
- return $data;
- }
- }
- }
-
- /**
- * The "children" collection of methods.
- * Typical usage is:
- * <code>
- * $driveService = new Google_DriveService(...);
- * $children = $driveService->children;
- * </code>
- */
- class Google_ChildrenServiceResource extends Google_ServiceResource {
-
-
- /**
- * Removes a child from a folder. (children.delete)
- *
- * @param string $folderId The ID of the folder.
- * @param string $childId The ID of the child.
- * @param array $optParams Optional parameters.
- */
- public function delete($folderId, $childId, $optParams = array()) {
- $params = array('folderId' => $folderId, 'childId' => $childId);
- $params = array_merge($params, $optParams);
- $data = $this->__call('delete', array($params));
- return $data;
- }
- /**
- * Gets a specific child reference. (children.get)
- *
- * @param string $folderId The ID of the folder.
- * @param string $childId The ID of the child.
- * @param array $optParams Optional parameters.
- * @return Google_ChildReference
- */
- public function get($folderId, $childId, $optParams = array()) {
- $params = array('folderId' => $folderId, 'childId' => $childId);
- $params = array_merge($params, $optParams);
- $data = $this->__call('get', array($params));
- if ($this->useObjects()) {
- return new Google_ChildReference($data);
- } else {
- return $data;
- }
- }
- /**
- * Inserts a file into a folder. (children.insert)
- *
- * @param string $folderId The ID of the folder.
- * @param Google_ChildReference $postBody
- * @param array $optParams Optional parameters.
- * @return Google_ChildReference
- */
- public function insert($folderId, Google_ChildReference $postBody, $optParams = array()) {
- $params = array('folderId' => $folderId, 'postBody' => $postBody);
- $params = array_merge($params, $optParams);
- $data = $this->__call('insert', array($params));
- if ($this->useObjects()) {
- return new Google_ChildReference($data);
- } else {
- return $data;
- }
- }
- /**
- * Lists a folder's children. (children.list)
- *
- * @param string $folderId The ID of the folder.
- * @param array $optParams Optional parameters.
- *
- * @opt_param int maxResults Maximum number of children to return.
- * @opt_param string pageToken Page token for children.
- * @opt_param string q Query string for searching children.
- * @return Google_ChildList
- */
- public function listChildren($folderId, $optParams = array()) {
- $params = array('folderId' => $folderId);
- $params = array_merge($params, $optParams);
- $data = $this->__call('list', array($params));
- if ($this->useObjects()) {
- return new Google_ChildList($data);
- } else {
- return $data;
- }
- }
- }
-
- /**
- * The "comments" collection of methods.
- * Typical usage is:
- * <code>
- * $driveService = new Google_DriveService(...);
- * $comments = $driveService->comments;
- * </code>
- */
- class Google_CommentsServiceResource extends Google_ServiceResource {
-
-
- /**
- * Deletes a comment. (comments.delete)
- *
- * @param string $fileId The ID of the file.
- * @param string $commentId The ID of the comment.
- * @param array $optParams Optional parameters.
- */
- public function delete($fileId, $commentId, $optParams = array()) {
- $params = array('fileId' => $fileId, 'commentId' => $commentId);
- $params = array_merge($params, $optParams);
- $data = $this->__call('delete', array($params));
- return $data;
- }
- /**
- * Gets a comment by ID. (comments.get)
- *
- * @param string $fileId The ID of the file.
- * @param string $commentId The ID of the comment.
- * @param array $optParams Optional parameters.
- *
- * @opt_param bool includeDeleted If set, this will succeed when retrieving a deleted comment, and will include any deleted replies.
- * @return Google_Comment
- */
- public function get($fileId, $commentId, $optParams = array()) {
- $params = array('fileId' => $fileId, 'commentId' => $commentId);
- $params = array_merge($params, $optParams);
- $data = $this->__call('get', array($params));
- if ($this->useObjects()) {
- return new Google_Comment($data);
- } else {
- return $data;
- }
- }
- /**
- * Creates a new comment on the given file. (comments.insert)
- *
- * @param string $fileId The ID of the file.
- * @param Google_Comment $postBody
- * @param array $optParams Optional parameters.
- * @return Google_Comment
- */
- public function insert($fileId, Google_Comment $postBody, $optParams = array()) {
- $params = array('fileId' => $fileId, 'postBody' => $postBody);
- $params = array_merge($params, $optParams);
- $data = $this->__call('insert', array($params));
- if ($this->useObjects()) {
- return new Google_Comment($data);
- } else {
- return $data;
- }
- }
- /**
- * Lists a file's comments. (comments.list)
- *
- * @param string $fileId The ID of the file.
- * @param array $optParams Optional parameters.
- *
- * @opt_param bool includeDeleted If set, all comments and replies, including deleted comments and replies (with content stripped) will be returned.
- * @opt_param int maxResults The maximum number of discussions to include in the response, used for paging.
- * @opt_param string pageToken The continuation token, used to page through large result sets. To get the next page of results, set this parameter to the value of "nextPageToken" from the previous response.
- * @opt_param string updatedMin Only discussions that were updated after this timestamp will be returned. Formatted as an RFC 3339 timestamp.
- * @return Google_CommentList
- */
- public function listComments($fileId, $optParams = array()) {
- $params = array('fileId' => $fileId);
- $params = array_merge($params, $optParams);
- $data = $this->__call('list', array($params));
- if ($this->useObjects()) {
- return new Google_CommentList($data);
- } else {
- return $data;
- }
- }
- /**
- * Updates an existing comment. This method supports patch semantics. (comments.patch)
- *
- * @param string $fileId The ID of the file.
- * @param string $commentId The ID of the comment.
- * @param Google_Comment $postBody
- * @param array $optParams Optional parameters.
- * @return Google_Comment
- */
- public function patch($fileId, $commentId, Google_Comment $postBody, $optParams = array()) {
- $params = array('fileId' => $fileId, 'commentId' => $commentId, 'postBody' => $postBody);
- $params = array_merge($params, $optParams);
- $data = $this->__call('patch', array($params));
- if ($this->useObjects()) {
- return new Google_Comment($data);
- } else {
- return $data;
- }
- }
- /**
- * Updates an existing comment. (comments.update)
- *
- * @param string $fileId The ID of the file.
- * @param string $commentId The ID of the comment.
- * @param Google_Comment $postBody
- * @param array $optParams Optional parameters.
- * @return Google_Comment
- */
- public function update($fileId, $commentId, Google_Comment $postBody, $optParams = array()) {
- $params = array('fileId' => $fileId, 'commentId' => $commentId, 'postBody' => $postBody);
- $params = array_merge($params, $optParams);
- $data = $this->__call('update', array($params));
- if ($this->useObjects()) {
- return new Google_Comment($data);
- } else {
- return $data;
- }
- }
- }
-
- /**
- * The "files" collection of methods.
- * Typical usage is:
- * <code>
- * $driveService = new Google_DriveService(...);
- * $files = $driveService->files;
- * </code>
- */
- class Google_FilesServiceResource extends Google_ServiceResource {
-
-
- /**
- * Creates a copy of the specified file. (files.copy)
- *
- * @param string $fileId The ID of the file to copy.
- * @param Google_DriveFile $postBody
- * @param array $optParams Optional parameters.
- *
- * @opt_param bool convert Whether to convert this file to the corresponding Google Docs format.
- * @opt_param bool ocr Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads.
- * @opt_param string ocrLanguage If ocr is true, hints at the language to use. Valid values are ISO 639-1 codes.
- * @opt_param bool pinned Whether to pin the head revision of the new copy.
- * @opt_param string timedTextLanguage The language of the timed text.
- * @opt_param string timedTextTrackName The timed text track name.
- * @return Google_DriveFile
- */
- public function copy($fileId, Google_DriveFile $postBody, $optParams = array()) {
- $params = array('fileId' => $fileId, 'postBody' => $postBody);
- $params = array_merge($params, $optParams);
- $data = $this->__call('copy', array($params));
- if ($this->useObjects()) {
- return new Google_DriveFile($data);
- } else {
- return $data;
- }
- }
- /**
- * Permanently deletes a file by ID. Skips the trash. (files.delete)
- *
- * @param string $fileId The ID of the file to delete.
- * @param array $optParams Optional parameters.
- */
- public function delete($fileId, $optParams = array()) {
- $params = array('fileId' => $fileId);
- $params = array_merge($params, $optParams);
- $data = $this->__call('delete', array($params));
- return $data;
- }
- /**
- * Gets a file's metadata by ID. (files.get)
- *
- * @param string $fileId The ID for the file in question.
- * @param array $optParams Optional parameters.
- *
- * @opt_param string projection This parameter is deprecated and has no function.
- * @opt_param bool updateViewedDate Whether to update the view date after successfully retrieving the file.
- * @return Google_DriveFile
- */
- public function get($fileId, $optParams = array()) {
- $params = array('fileId' => $fileId);
- $params = array_merge($params, $optParams);
- $data = $this->__call('get', array($params));
- if ($this->useObjects()) {
- return new Google_DriveFile($data);
- } else {
- return $data;
- }
- }
- /**
- * Insert a new file. (files.insert)
- *
- * @param Google_DriveFile $postBody
- * @param array $optParams Optional parameters.
- *
- * @opt_param bool convert Whether to convert this file to the corresponding Google Docs format.
- * @opt_param bool ocr Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads.
- * @opt_param string ocrLanguage If ocr is true, hints at the language to use. Valid values are ISO 639-1 codes.
- * @opt_param bool pinned Whether to pin the head revision of the uploaded file.
- * @opt_param string timedTextLanguage The language of the timed text.
- * @opt_param string timedTextTrackName The timed text track name.
- * @opt_param bool useContentAsIndexableText Whether to use the content as indexable text.
- * @return Google_DriveFile
- */
- public function insert(Google_DriveFile $postBody, $optParams = array()) {
- $params = array('postBody' => $postBody);
- $params = array_merge($params, $optParams);
- $data = $this->__call('insert', array($params));
- if ($this->useObjects()) {
- return new Google_DriveFile($data);
- } else {
- return $data;
- }
- }
- /**
- * Lists the user's files. (files.list)
- *
- * @param array $optParams Optional parameters.
- *
- * @opt_param int maxResults Maximum number of files to return.
- * @opt_param string pageToken Page token for files.
- * @opt_param string projection This parameter is deprecated and has no function.
- * @opt_param string q Query string for searching files.
- * @return Google_FileList
- */
- public function listFiles($optParams = array()) {
- $params = array();
- $params = array_merge($params, $optParams);
- $data = $this->__call('list', array($params));
- if ($this->useObjects()) {
- return new Google_FileList($data);
- } else {
- return $data;
- }
- }
- /**
- * Updates file metadata and/or content. This method supports patch semantics. (files.patch)
- *
- * @param string $fileId The ID of the file to update.
- * @param Google_DriveFile $postBody
- * @param array $optParams Optional parameters.
- *
- * @opt_param bool convert Whether to convert this file to the corresponding Google Docs format.
- * @opt_param bool newRevision Whether a blob upload should create a new revision. If not set or false, the blob data in the current head revision is replaced. If true, a new blob is created as head revision, and previous revisions are preserved (causing increased use of the user's data storage quota).
- * @opt_param bool ocr Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads.
- * @opt_param string ocrLanguage If ocr is true, hints at the language to use. Valid values are ISO 639-1 codes.
- * @opt_param bool pinned Whether to pin the new revision.
- * @opt_param bool setModifiedDate Whether to set the modified date with the supplied modified date.
- * @opt_param string timedTextLanguage The language of the timed text.
- * @opt_param string timedTextTrackName The timed text track name.
- * @opt_param bool updateViewedDate Whether to update the view date after successfully updating the file.
- * @opt_param bool useContentAsIndexableText Whether to use the content as indexable text.
- * @return Google_DriveFile
- */
- public function patch($fileId, Google_DriveFile $postBody, $optParams = array()) {
- $params = array('fileId' => $fileId, 'postBody' => $postBody);
- $params = array_merge($params, $optParams);
- $data = $this->__call('patch', array($params));
- if ($this->useObjects()) {
- return new Google_DriveFile($data);
- } else {
- return $data;
- }
- }
- /**
- * Set the file's updated time to the current server time. (files.touch)
- *
- * @param string $fileId The ID of the file to update.
- * @param array $optParams Optional parameters.
- * @return Google_DriveFile
- */
- public function touch($fileId, $optParams = array()) {
- $params = array('fileId' => $fileId);
- $params = array_merge($params, $optParams);
- $data = $this->__call('touch', array($params));
- if ($this->useObjects()) {
- return new Google_DriveFile($data);
- } else {
- return $data;
- }
- }
- /**
- * Moves a file to the trash. (files.trash)
- *
- * @param string $fileId The ID of the file to trash.
- * @param array $optParams Optional parameters.
- * @return Google_DriveFile
- */
- public function trash($fileId, $optParams = array()) {
- $params = array('fileId' => $fileId);
- $params = array_merge($params, $optParams);
- $data = $this->__call('trash', array($params));
- if ($this->useObjects()) {
- return new Google_DriveFile($data);
- } else {
- return $data;
- }
- }
- /**
- * Restores a file from the trash. (files.untrash)
- *
- * @param string $fileId The ID of the file to untrash.
- * @param array $optParams Optional parameters.
- * @return Google_DriveFile
- */
- public function untrash($fileId, $optParams = array()) {
- $params = array('fileId' => $fileId);
- $params = array_merge($params, $optParams);
- $data = $this->__call('untrash', array($params));
- if ($this->useObjects()) {
- return new Google_DriveFile($data);
- } else {
- return $data;
- }
- }
- /**
- * Updates file metadata and/or content. (files.update)
- *
- * @param string $fileId The ID of the file to update.
- * @param Google_DriveFile $postBody
- * @param array $optParams Optional parameters.
- *
- * @opt_param bool convert Whether to convert this file to the corresponding Google Docs format.
- * @opt_param bool newRevision Whether a blob upload should create a new revision. If not set or false, the blob data in the current head revision is replaced. If true, a new blob is created as head revision, and previous revisions are preserved (causing increased use of the user's data storage quota).
- * @opt_param bool ocr Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads.
- * @opt_param string ocrLanguage If ocr is true, hints at the language to use. Valid values are ISO 639-1 codes.
- * @opt_param bool pinned Whether to pin the new revision.
- * @opt_param bool setModifiedDate Whether to set the modified date with the supplied modified date.
- * @opt_param string timedTextLanguage The language of the timed text.
- * @opt_param string timedTextTrackName The timed text track name.
- * @opt_param bool updateViewedDate Whether to update the view date after successfully updating the file.
- * @opt_param bool useContentAsIndexableText Whether to use the content as indexable text.
- * @return Google_DriveFile
- */
- public function update($fileId, Google_DriveFile $postBody, $optParams = array()) {
- $params = array('fileId' => $fileId, 'postBody' => $postBody);
- $params = array_merge($params, $optParams);
- $data = $this->__call('update', array($params));
- if ($this->useObjects()) {
- return new Google_DriveFile($data);
- } else {
- return $data;
- }
- }
- }
-
- /**
- * The "parents" collection of methods.
- * Typical usage is:
- * <code>
- * $driveService = new Google_DriveService(...);
- * $parents = $driveService->parents;
- * </code>
- */
- class Google_ParentsServiceResource extends Google_ServiceResource {
-
-
- /**
- * Removes a parent from a file. (parents.delete)
- *
- * @param string $fileId The ID of the file.
- * @param string $parentId The ID of the parent.
- * @param array $optParams Optional parameters.
- */
- public function delete($fileId, $parentId, $optParams = array()) {
- $params = array('fileId' => $fileId, 'parentId' => $parentId);
- $params = array_merge($params, $optParams);
- $data = $this->__call('delete', array($params));
- return $data;
- }
- /**
- * Gets a specific parent reference. (parents.get)
- *
- * @param string $fileId The ID of the file.
- * @param string $parentId The ID of the parent.
- * @param array $optParams Optional parameters.
- * @return Google_ParentReference
- */
- public function get($fileId, $parentId, $optParams = array()) {
- $params = array('fileId' => $fileId, 'parentId' => $parentId);
- $params = array_merge($params, $optParams);
- $data = $this->__call('get', array($params));
- if ($this->useObjects()) {
- return new Google_ParentReference($data);
- } else {
- return $data;
- }
- }
- /**
- * Adds a parent folder for a file. (parents.insert)
- *
- * @param string $fileId The ID of the file.
- * @param Google_ParentReference $postBody
- * @param array $optParams Optional parameters.
- * @return Google_ParentReference
- */
- public function insert($fileId, Google_ParentReference $postBody, $optParams = array()) {
- $params = array('fileId' => $fileId, 'postBody' => $postBody);
- $params = array_merge($params, $optParams);
- $data = $this->__call('insert', array($params));
- if ($this->useObjects()) {
- return new Google_ParentReference($data);
- } else {
- return $data;
- }
- }
- /**
- * Lists a file's parents. (parents.list)
- *
- * @param string $fileId The ID of the file.
- * @param array $optParams Optional parameters.
- * @return Google_ParentList
- */
- public function listParents($fileId, $optParams = array()) {
- $params = array('fileId' => $fileId);
- $params = array_merge($params, $optParams);
- $data = $this->__call('list', array($params));
- if ($this->useObjects()) {
- return new Google_ParentList($data);
- } else {
- return $data;
- }
- }
- }
-
- /**
- * The "permissions" collection of methods.
- * Typical usage is:
- * <code>
- * $driveService = new Google_DriveService(...);
- * $permissions = $driveService->permissions;
- * </code>
- */
- class Google_PermissionsServiceResource extends Google_ServiceResource {
-
-
- /**
- * Deletes a permission from a file. (permissions.delete)
- *
- * @param string $fileId The ID for the file.
- * @param string $permissionId The ID for the permission.
- * @param array $optParams Optional parameters.
- */
- public function delete($fileId, $permissionId, $optParams = array()) {
- $params = array('fileId' => $fileId, 'permissionId' => $permissionId);
- $params = array_merge($params, $optParams);
- $data = $this->__call('delete', array($params));
- return $data;
- }
- /**
- * Gets a permission by ID. (permissions.get)
- *
- * @param string $fileId The ID for the file.
- * @param string $permissionId The ID for the permission.
- * @param array $optParams Optional parameters.
- * @return Google_Permission
- */
- public function get($fileId, $permissionId, $optParams = array()) {
- $params = array('fileId' => $fileId, 'permissionId' => $permissionId);
- $params = array_merge($params, $optParams);
- $data = $this->__call('get', array($params));
- if ($this->useObjects()) {
- return new Google_Permission($data);
- } else {
- return $data;
- }
- }
- /**
- * Inserts a permission for a file. (permissions.insert)
- *
- * @param string $fileId The ID for the file.
- * @param Google_Permission $postBody
- * @param array $optParams Optional parameters.
- *
- * @opt_param string emailMessage A custom message to include in notification emails.
- * @opt_param bool sendNotificationEmails Whether to send notification emails when sharing to users or groups.
- * @return Google_Permission
- */
- public function insert($fileId, Google_Permission $postBody, $optParams = array()) {
- $params = array('fileId' => $fileId, 'postBody' => $postBody);
- $params = array_merge($params, $optParams);
- $data = $this->__call('insert', array($params));
- if ($this->useObjects()) {
- return new Google_Permission($data);
- } else {
- return $data;
- }
- }
- /**
- * Lists a file's permissions. (permissions.list)
- *
- * @param string $fileId The ID for the file.
- * @param array $optParams Optional parameters.
- * @return Google_PermissionList
- */
- public function listPermissions($fileId, $optParams = array()) {
- $params = array('fileId' => $fileId);
- $params = array_merge($params, $optParams);
- $data = $this->__call('list', array($params));
- if ($this->useObjects()) {
- return new Google_PermissionList($data);
- } else {
- return $data;
- }
- }
- /**
- * Updates a permission. This method supports patch semantics. (permissions.patch)
- *
- * @param string $fileId The ID for the file.
- * @param string $permissionId The ID for the permission.
- * @param Google_Permission $postBody
- * @param array $optParams Optional parameters.
- *
- * @opt_param bool transferOwnership Whether changing a role to 'owner' should also downgrade the current owners to writers.
- * @return Google_Permission
- */
- public function patch($fileId, $permissionId, Google_Permission $postBody, $optParams = array()) {
- $params = array('fileId' => $fileId, 'permissionId' => $permissionId, 'postBody' => $postBody);
- $params = array_merge($params, $optParams);
- $data = $this->__call('patch', array($params));
- if ($this->useObjects()) {
- return new Google_Permission($data);
- } else {
- return $data;
- }
- }
- /**
- * Updates a permission. (permissions.update)
- *
- * @param string $fileId The ID for the file.
- * @param string $permissionId The ID for the permission.
- * @param Google_Permission $postBody
- * @param array $optParams Optional parameters.
- *
- * @opt_param bool transferOwnership Whether changing a role to 'owner' should also downgrade the current owners to writers.
- * @return Google_Permission
- */
- public function update($fileId, $permissionId, Google_Permission $postBody, $optParams = array()) {
- $params = array('fileId' => $fileId, 'permissionId' => $permissionId, 'postBody' => $postBody);
- $params = array_merge($params, $optParams);
- $data = $this->__call('update', array($params));
- if ($this->useObjects()) {
- return new Google_Permission($data);
- } else {
- return $data;
- }
- }
- }
-
- /**
- * The "properties" collection of methods.
- * Typical usage is:
- * <code>
- * $driveService = new Google_DriveService(...);
- * $properties = $driveService->properties;
- * </code>
- */
- class Google_PropertiesServiceResource extends Google_ServiceResource {
-
-
- /**
- * Deletes a property. (properties.delete)
- *
- * @param string $fileId The ID of the file.
- * @param string $propertyKey The key of the property.
- * @param array $optParams Optional parameters.
- *
- * @opt_param string visibility The visibility of the property.
- */
- public function delete($fileId, $propertyKey, $optParams = array()) {
- $params = array('fileId' => $fileId, 'propertyKey' => $propertyKey);
- $params = array_merge($params, $optParams);
- $data = $this->__call('delete', array($params));
- return $data;
- }
- /**
- * Gets a property by its key. (properties.get)
- *
- * @param string $fileId The ID of the file.
- * @param string $propertyKey The key of the property.
- * @param array $optParams Optional parameters.
- *
- * @opt_param string visibility The visibility of the property.
- * @return Google_Property
- */
- public function get($fileId, $propertyKey, $optParams = array()) {
- $params = array('fileId' => $fileId, 'propertyKey' => $propertyKey);
- $params = array_merge($params, $optParams);
- $data = $this->__call('get', array($params));
- if ($this->useObjects()) {
- return new Google_Property($data);
- } else {
- return $data;
- }
- }
- /**
- * Adds a property to a file. (properties.insert)
- *
- * @param string $fileId The ID of the file.
- * @param Google_Property $postBody
- * @param array $optParams Optional parameters.
- * @return Google_Property
- */
- public function insert($fileId, Google_Property $postBody, $optParams = array()) {
- $params = array('fileId' => $fileId, 'postBody' => $postBody);
- $params = array_merge($params, $optParams);
- $data = $this->__call('insert', array($params));
- if ($this->useObjects()) {
- return new Google_Property($data);
- } else {
- return $data;
- }
- }
- /**
- * Lists a file's properties. (properties.list)
- *
- * @param string $fileId The ID of the file.
- * @param array $optParams Optional parameters.
- * @return Google_PropertyList
- */
- public function listProperties($fileId, $optParams = array()) {
- $params = array('fileId' => $fileId);
- $params = array_merge($params, $optParams);
- $data = $this->__call('list', array($params));
- if ($this->useObjects()) {
- return new Google_PropertyList($data);
- } else {
- return $data;
- }
- }
- /**
- * Updates a property. This method supports patch semantics. (properties.patch)
- *
- * @param string $fileId The ID of the file.
- * @param string $propertyKey The key of the property.
- * @param Google_Property $postBody
- * @param array $optParams Optional parameters.
- *
- * @opt_param string visibility The visibility of the property.
- * @return Google_Property
- */
- public function patch($fileId, $propertyKey, Google_Property $postBody, $optParams = array()) {
- $params = array('fileId' => $fileId, 'propertyKey' => $propertyKey, 'postBody' => $postBody);
- $params = array_merge($params, $optParams);
- $data = $this->__call('patch', array($params));
- if ($this->useObjects()) {
- return new Google_Property($data);
- } else {
- return $data;
- }
- }
- /**
- * Updates a property. (properties.update)
- *
- * @param string $fileId The ID of the file.
- * @param string $propertyKey The key of the property.
- * @param Google_Property $postBody
- * @param array $optParams Optional parameters.
- *
- * @opt_param string visibility The visibility of the property.
- * @return Google_Property
- */
- public function update($fileId, $propertyKey, Google_Property $postBody, $optParams = array()) {
- $params = array('fileId' => $fileId, 'propertyKey' => $propertyKey, 'postBody' => $postBody);
- $params = array_merge($params, $optParams);
- $data = $this->__call('update', array($params));
- if ($this->useObjects()) {
- return new Google_Property($data);
- } else {
- return $data;
- }
- }
- }
-
- /**
- * The "replies" collection of methods.
- * Typical usage is:
- * <code>
- * $driveService = new Google_DriveService(...);
- * $replies = $driveService->replies;
- * </code>
- */
- class Google_RepliesServiceResource extends Google_ServiceResource {
-
-
- /**
- * Deletes a reply. (replies.delete)
- *
- * @param string $fileId The ID of the file.
- * @param string $commentId The ID of the comment.
- * @param string $replyId The ID of the reply.
- * @param array $optParams Optional parameters.
- */
- public function delete($fileId, $commentId, $replyId, $optParams = array()) {
- $params = array('fileId' => $fileId, 'commentId' => $commentId, 'replyId' => $replyId);
- $params = array_merge($params, $optParams);
- $data = $this->__call('delete', array($params));
- return $data;
- }
- /**
- * Gets a reply. (replies.get)
- *
- * @param string $fileId The ID of the file.
- * @param string $commentId The ID of the comment.
- * @param string $replyId The ID of the reply.
- * @param array $optParams Optional parameters.
- *
- * @opt_param bool includeDeleted If set, this will succeed when retrieving a deleted reply.
- * @return Google_CommentReply
- */
- public function get($fileId, $commentId, $replyId, $optParams = array()) {
- $params = array('fileId' => $fileId, 'commentId' => $commentId, 'replyId' => $replyId);
- $params = array_merge($params, $optParams);
- $data = $this->__call('get', array($params));
- if ($this->useObjects()) {
- return new Google_CommentReply($data);
- } else {
- return $data;
- }
- }
- /**
- * Creates a new reply to the given comment. (replies.insert)
- *
- * @param string $fileId The ID of the file.
- * @param string $commentId The ID of the comment.
- * @param Google_CommentReply $postBody
- * @param array $optParams Optional parameters.
- * @return Google_CommentReply
- */
- public function insert($fileId, $commentId, Google_CommentReply $postBody, $optParams = array()) {
- $params = array('fileId' => $fileId, 'commentId' => $commentId, 'postBody' => $postBody);
- $params = array_merge($params, $optParams);
- $data = $this->__call('insert', array($params));
- if ($this->useObjects()) {
- return new Google_CommentReply($data);
- } else {
- return $data;
- }
- }
- /**
- * Lists all of the replies to a comment. (replies.list)
- *
- * @param string $fileId The ID of the file.
- * @param string $commentId The ID of the comment.
- * @param array $optParams Optional parameters.
- *
- * @opt_param bool includeDeleted If set, all replies, including deleted replies (with content stripped) will be returned.
- * @opt_param int maxResults The maximum number of replies to include in the response, used for paging.
- * @opt_param string pageToken The continuation token, used to page through large result sets. To get the next page of results, set this parameter to the value of "nextPageToken" from the previous response.
- * @return Google_CommentReplyList
- */
- public function listReplies($fileId, $commentId, $optParams = array()) {
- $params = array('fileId' => $fileId, 'commentId' => $commentId);
- $params = array_merge($params, $optParams);
- $data = $this->__call('list', array($params));
- if ($this->useObjects()) {
- return new Google_CommentReplyList($data);
- } else {
- return $data;
- }
- }
- /**
- * Updates an existing reply. This method supports patch semantics. (replies.patch)
- *
- * @param string $fileId The ID of the file.
- * @param string $commentId The ID of the comment.
- * @param string $replyId The ID of the reply.
- * @param Google_CommentReply $postBody
- * @param array $optParams Optional parameters.
- * @return Google_CommentReply
- */
- public function patch($fileId, $commentId, $replyId, Google_CommentReply $postBody, $optParams = array()) {
- $params = array('fileId' => $fileId, 'commentId' => $commentId, 'replyId' => $replyId, 'postBody' => $postBody);
- $params = array_merge($params, $optParams);
- $data = $this->__call('patch', array($params));
- if ($this->useObjects()) {
- return new Google_CommentReply($data);
- } else {
- return $data;
- }
- }
- /**
- * Updates an existing reply. (replies.update)
- *
- * @param string $fileId The ID of the file.
- * @param string $commentId The ID of the comment.
- * @param string $replyId The ID of the reply.
- * @param Google_CommentReply $postBody
- * @param array $optParams Optional parameters.
- * @return Google_CommentReply
- */
- public function update($fileId, $commentId, $replyId, Google_CommentReply $postBody, $optParams = array()) {
- $params = array('fileId' => $fileId, 'commentId' => $commentId, 'replyId' => $replyId, 'postBody' => $postBody);
- $params = array_merge($params, $optParams);
- $data = $this->__call('update', array($params));
- if ($this->useObjects()) {
- return new Google_CommentReply($data);
- } else {
- return $data;
- }
- }
- }
-
- /**
- * The "revisions" collection of methods.
- * Typical usage is:
- * <code>
- * $driveService = new Google_DriveService(...);
- * $revisions = $driveService->revisions;
- * </code>
- */
- class Google_RevisionsServiceResource extends Google_ServiceResource {
-
-
- /**
- * Removes a revision. (revisions.delete)
- *
- * @param string $fileId The ID of the file.
- * @param string $revisionId The ID of the revision.
- * @param array $optParams Optional parameters.
- */
- public function delete($fileId, $revisionId, $optParams = array()) {
- $params = array('fileId' => $fileId, 'revisionId' => $revisionId);
- $params = array_merge($params, $optParams);
- $data = $this->__call('delete', array($params));
- return $data;
- }
- /**
- * Gets a specific revision. (revisions.get)
- *
- * @param string $fileId The ID of the file.
- * @param string $revisionId The ID of the revision.
- * @param array $optParams Optional parameters.
- * @return Google_Revision
- */
- public function get($fileId, $revisionId, $optParams = array()) {
- $params = array('fileId' => $fileId, 'revisionId' => $revisionId);
- $params = array_merge($params, $optParams);
- $data = $this->__call('get', array($params));
- if ($this->useObjects()) {
- return new Google_Revision($data);
- } else {
- return $data;
- }
- }
- /**
- * Lists a file's revisions. (revisions.list)
- *
- * @param string $fileId The ID of the file.
- * @param array $optParams Optional parameters.
- * @return Google_RevisionList
- */
- public function listRevisions($fileId, $optParams = array()) {
- $params = array('fileId' => $fileId);
- $params = array_merge($params, $optParams);
- $data = $this->__call('list', array($params));
- if ($this->useObjects()) {
- return new Google_RevisionList($data);
- } else {
- return $data;
- }
- }
- /**
- * Updates a revision. This method supports patch semantics. (revisions.patch)
- *
- * @param string $fileId The ID for the file.
- * @param string $revisionId The ID for the revision.
- * @param Google_Revision $postBody
- * @param array $optParams Optional parameters.
- * @return Google_Revision
- */
- public function patch($fileId, $revisionId, Google_Revision $postBody, $optParams = array()) {
- $params = array('fileId' => $fileId, 'revisionId' => $revisionId, 'postBody' => $postBody);
- $params = array_merge($params, $optParams);
- $data = $this->__call('patch', array($params));
- if ($this->useObjects()) {
- return new Google_Revision($data);
- } else {
- return $data;
- }
- }
- /**
- * Updates a revision. (revisions.update)
- *
- * @param string $fileId The ID for the file.
- * @param string $revisionId The ID for the revision.
- * @param Google_Revision $postBody
- * @param array $optParams Optional parameters.
- * @return Google_Revision
- */
- public function update($fileId, $revisionId, Google_Revision $postBody, $optParams = array()) {
- $params = array('fileId' => $fileId, 'revisionId' => $revisionId, 'postBody' => $postBody);
- $params = array_merge($params, $optParams);
- $data = $this->__call('update', array($params));
- if ($this->useObjects()) {
- return new Google_Revision($data);
- } else {
- return $data;
- }
- }
- }
-
-/**
- * Service definition for Google_Drive (v2).
- *
- * <p>
- * The API to interact with Drive.
- * </p>
- *
- * <p>
- * For more information about this service, see the
- * <a href="https://developers.google.com/drive/" target="_blank">API Documentation</a>
- * </p>
- *
- * @author Google, Inc.
- */
-class Google_DriveService extends Google_Service {
- public $about;
- public $apps;
- public $changes;
- public $children;
- public $comments;
- public $files;
- public $parents;
- public $permissions;
- public $properties;
- public $replies;
- public $revisions;
- /**
- * Constructs the internal representation of the Drive service.
- *
- * @param Google_Client $client
- */
- public function __construct(Google_Client $client) {
- $this->servicePath = 'drive/v2/';
- $this->version = 'v2';
- $this->serviceName = 'drive';
-
- $client->addService($this->serviceName, $this->version);
- $this->about = new Google_AboutServiceResource($this, $this->serviceName, 'about', json_decode('{"methods": {"get": {"id": "drive.about.get", "path": "about", "httpMethod": "GET", "parameters": {"includeSubscribed": {"type": "boolean", "default": "true", "location": "query"}, "maxChangeIdCount": {"type": "string", "default": "1", "format": "int64", "location": "query"}, "startChangeId": {"type": "string", "format": "int64", "location": "query"}}, "response": {"$ref": "About"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly"]}}}', true));
- $this->apps = new Google_AppsServiceResource($this, $this->serviceName, 'apps', json_decode('{"methods": {"get": {"id": "drive.apps.get", "path": "apps/{appId}", "httpMethod": "GET", "parameters": {"appId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "App"}, "scopes": ["https://www.googleapis.com/auth/drive.apps.readonly"]}, "list": {"id": "drive.apps.list", "path": "apps", "httpMethod": "GET", "response": {"$ref": "AppList"}, "scopes": ["https://www.googleapis.com/auth/drive.apps.readonly"]}}}', true));
- $this->changes = new Google_ChangesServiceResource($this, $this->serviceName, 'changes', json_decode('{"methods": {"get": {"id": "drive.changes.get", "path": "changes/{changeId}", "httpMethod": "GET", "parameters": {"changeId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "Change"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly"]}, "list": {"id": "drive.changes.list", "path": "changes", "httpMethod": "GET", "parameters": {"includeDeleted": {"type": "boolean", "default": "true", "location": "query"}, "includeSubscribed": {"type": "boolean", "default": "true", "location": "query"}, "maxResults": {"type": "integer", "default": "100", "format": "int32", "minimum": "0", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "startChangeId": {"type": "string", "format": "int64", "location": "query"}}, "response": {"$ref": "ChangeList"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly"], "supportsSubscription": true}}}', true));
- $this->children = new Google_ChildrenServiceResource($this, $this->serviceName, 'children', json_decode('{"methods": {"delete": {"id": "drive.children.delete", "path": "files/{folderId}/children/{childId}", "httpMethod": "DELETE", "parameters": {"childId": {"type": "string", "required": true, "location": "path"}, "folderId": {"type": "string", "required": true, "location": "path"}}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "get": {"id": "drive.children.get", "path": "files/{folderId}/children/{childId}", "httpMethod": "GET", "parameters": {"childId": {"type": "string", "required": true, "location": "path"}, "folderId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "ChildReference"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly"]}, "insert": {"id": "drive.children.insert", "path": "files/{folderId}/children", "httpMethod": "POST", "parameters": {"folderId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "ChildReference"}, "response": {"$ref": "ChildReference"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "list": {"id": "drive.children.list", "path": "files/{folderId}/children", "httpMethod": "GET", "parameters": {"folderId": {"type": "string", "required": true, "location": "path"}, "maxResults": {"type": "integer", "default": "100", "format": "int32", "minimum": "0", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "q": {"type": "string", "location": "query"}}, "response": {"$ref": "ChildList"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly"]}}}', true));
- $this->comments = new Google_CommentsServiceResource($this, $this->serviceName, 'comments', json_decode('{"methods": {"delete": {"id": "drive.comments.delete", "path": "files/{fileId}/comments/{commentId}", "httpMethod": "DELETE", "parameters": {"commentId": {"type": "string", "required": true, "location": "path"}, "fileId": {"type": "string", "required": true, "location": "path"}}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.readonly"]}, "get": {"id": "drive.comments.get", "path": "files/{fileId}/comments/{commentId}", "httpMethod": "GET", "parameters": {"commentId": {"type": "string", "required": true, "location": "path"}, "fileId": {"type": "string", "required": true, "location": "path"}, "includeDeleted": {"type": "boolean", "default": "false", "location": "query"}}, "response": {"$ref": "Comment"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.readonly"]}, "insert": {"id": "drive.comments.insert", "path": "files/{fileId}/comments", "httpMethod": "POST", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Comment"}, "response": {"$ref": "Comment"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.readonly"]}, "list": {"id": "drive.comments.list", "path": "files/{fileId}/comments", "httpMethod": "GET", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "includeDeleted": {"type": "boolean", "default": "false", "location": "query"}, "maxResults": {"type": "integer", "default": "20", "format": "int32", "minimum": "0", "maximum": "100", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "updatedMin": {"type": "string", "location": "query"}}, "response": {"$ref": "CommentList"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.readonly"]}, "patch": {"id": "drive.comments.patch", "path": "files/{fileId}/comments/{commentId}", "httpMethod": "PATCH", "parameters": {"commentId": {"type": "string", "required": true, "location": "path"}, "fileId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Comment"}, "response": {"$ref": "Comment"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "update": {"id": "drive.comments.update", "path": "files/{fileId}/comments/{commentId}", "httpMethod": "PUT", "parameters": {"commentId": {"type": "string", "required": true, "location": "path"}, "fileId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Comment"}, "response": {"$ref": "Comment"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}}}', true));
- $this->files = new Google_FilesServiceResource($this, $this->serviceName, 'files', json_decode('{"methods": {"copy": {"id": "drive.files.copy", "path": "files/{fileId}/copy", "httpMethod": "POST", "parameters": {"convert": {"type": "boolean", "default": "false", "location": "query"}, "fileId": {"type": "string", "required": true, "location": "path"}, "ocr": {"type": "boolean", "default": "false", "location": "query"}, "ocrLanguage": {"type": "string", "location": "query"}, "pinned": {"type": "boolean", "default": "false", "location": "query"}, "timedTextLanguage": {"type": "string", "location": "query"}, "timedTextTrackName": {"type": "string", "location": "query"}}, "request": {"$ref": "File"}, "response": {"$ref": "File"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "delete": {"id": "drive.files.delete", "path": "files/{fileId}", "httpMethod": "DELETE", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "get": {"id": "drive.files.get", "path": "files/{fileId}", "httpMethod": "GET", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "projection": {"type": "string", "enum": ["BASIC", "FULL"], "location": "query"}, "updateViewedDate": {"type": "boolean", "default": "false", "location": "query"}}, "response": {"$ref": "File"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly"], "supportsSubscription": true}, "insert": {"id": "drive.files.insert", "path": "files", "httpMethod": "POST", "parameters": {"convert": {"type": "boolean", "default": "false", "location": "query"}, "ocr": {"type": "boolean", "default": "false", "location": "query"}, "ocrLanguage": {"type": "string", "location": "query"}, "pinned": {"type": "boolean", "default": "false", "location": "query"}, "timedTextLanguage": {"type": "string", "location": "query"}, "timedTextTrackName": {"type": "string", "location": "query"}, "useContentAsIndexableText": {"type": "boolean", "default": "false", "location": "query"}}, "request": {"$ref": "File"}, "response": {"$ref": "File"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"], "supportsMediaUpload": true, "mediaUpload": {"accept": ["*/*"], "maxSize": "10GB", "protocols": {"simple": {"multipart": true, "path": "/upload/drive/v2/files"}, "resumable": {"multipart": true, "path": "/resumable/upload/drive/v2/files"}}}, "supportsSubscription": true}, "list": {"id": "drive.files.list", "path": "files", "httpMethod": "GET", "parameters": {"maxResults": {"type": "integer", "default": "100", "format": "int32", "minimum": "0", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "projection": {"type": "string", "enum": ["BASIC", "FULL"], "location": "query"}, "q": {"type": "string", "location": "query"}}, "response": {"$ref": "FileList"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly"]}, "patch": {"id": "drive.files.patch", "path": "files/{fileId}", "httpMethod": "PATCH", "parameters": {"convert": {"type": "boolean", "default": "false", "location": "query"}, "fileId": {"type": "string", "required": true, "location": "path"}, "newRevision": {"type": "boolean", "default": "true", "location": "query"}, "ocr": {"type": "boolean", "default": "false", "location": "query"}, "ocrLanguage": {"type": "string", "location": "query"}, "pinned": {"type": "boolean", "default": "false", "location": "query"}, "setModifiedDate": {"type": "boolean", "default": "false", "location": "query"}, "timedTextLanguage": {"type": "string", "location": "query"}, "timedTextTrackName": {"type": "string", "location": "query"}, "updateViewedDate": {"type": "boolean", "default": "true", "location": "query"}, "useContentAsIndexableText": {"type": "boolean", "default": "false", "location": "query"}}, "request": {"$ref": "File"}, "response": {"$ref": "File"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.scripts"]}, "touch": {"id": "drive.files.touch", "path": "files/{fileId}/touch", "httpMethod": "POST", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "File"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "trash": {"id": "drive.files.trash", "path": "files/{fileId}/trash", "httpMethod": "POST", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "File"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "untrash": {"id": "drive.files.untrash", "path": "files/{fileId}/untrash", "httpMethod": "POST", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "File"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "update": {"id": "drive.files.update", "path": "files/{fileId}", "httpMethod": "PUT", "parameters": {"convert": {"type": "boolean", "default": "false", "location": "query"}, "fileId": {"type": "string", "required": true, "location": "path"}, "newRevision": {"type": "boolean", "default": "true", "location": "query"}, "ocr": {"type": "boolean", "default": "false", "location": "query"}, "ocrLanguage": {"type": "string", "location": "query"}, "pinned": {"type": "boolean", "default": "false", "location": "query"}, "setModifiedDate": {"type": "boolean", "default": "false", "location": "query"}, "timedTextLanguage": {"type": "string", "location": "query"}, "timedTextTrackName": {"type": "string", "location": "query"}, "updateViewedDate": {"type": "boolean", "default": "true", "location": "query"}, "useContentAsIndexableText": {"type": "boolean", "default": "false", "location": "query"}}, "request": {"$ref": "File"}, "response": {"$ref": "File"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.scripts"], "supportsMediaUpload": true, "mediaUpload": {"accept": ["*/*"], "maxSize": "10GB", "protocols": {"simple": {"multipart": true, "path": "/upload/drive/v2/files/{fileId}"}, "resumable": {"multipart": true, "path": "/resumable/upload/drive/v2/files/{fileId}"}}}}}}', true));
- $this->parents = new Google_ParentsServiceResource($this, $this->serviceName, 'parents', json_decode('{"methods": {"delete": {"id": "drive.parents.delete", "path": "files/{fileId}/parents/{parentId}", "httpMethod": "DELETE", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "parentId": {"type": "string", "required": true, "location": "path"}}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "get": {"id": "drive.parents.get", "path": "files/{fileId}/parents/{parentId}", "httpMethod": "GET", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "parentId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "ParentReference"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly"]}, "insert": {"id": "drive.parents.insert", "path": "files/{fileId}/parents", "httpMethod": "POST", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "ParentReference"}, "response": {"$ref": "ParentReference"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "list": {"id": "drive.parents.list", "path": "files/{fileId}/parents", "httpMethod": "GET", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "ParentList"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly"]}}}', true));
- $this->permissions = new Google_PermissionsServiceResource($this, $this->serviceName, 'permissions', json_decode('{"methods": {"delete": {"id": "drive.permissions.delete", "path": "files/{fileId}/permissions/{permissionId}", "httpMethod": "DELETE", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "permissionId": {"type": "string", "required": true, "location": "path"}}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "get": {"id": "drive.permissions.get", "path": "files/{fileId}/permissions/{permissionId}", "httpMethod": "GET", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "permissionId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "Permission"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly"]}, "insert": {"id": "drive.permissions.insert", "path": "files/{fileId}/permissions", "httpMethod": "POST", "parameters": {"emailMessage": {"type": "string", "location": "query"}, "fileId": {"type": "string", "required": true, "location": "path"}, "sendNotificationEmails": {"type": "boolean", "default": "true", "location": "query"}}, "request": {"$ref": "Permission"}, "response": {"$ref": "Permission"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "list": {"id": "drive.permissions.list", "path": "files/{fileId}/permissions", "httpMethod": "GET", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "PermissionList"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly"]}, "patch": {"id": "drive.permissions.patch", "path": "files/{fileId}/permissions/{permissionId}", "httpMethod": "PATCH", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "permissionId": {"type": "string", "required": true, "location": "path"}, "transferOwnership": {"type": "boolean", "default": "false", "location": "query"}}, "request": {"$ref": "Permission"}, "response": {"$ref": "Permission"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "update": {"id": "drive.permissions.update", "path": "files/{fileId}/permissions/{permissionId}", "httpMethod": "PUT", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "permissionId": {"type": "string", "required": true, "location": "path"}, "transferOwnership": {"type": "boolean", "default": "false", "location": "query"}}, "request": {"$ref": "Permission"}, "response": {"$ref": "Permission"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}}}', true));
- $this->properties = new Google_PropertiesServiceResource($this, $this->serviceName, 'properties', json_decode('{"methods": {"delete": {"id": "drive.properties.delete", "path": "files/{fileId}/properties/{propertyKey}", "httpMethod": "DELETE", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "propertyKey": {"type": "string", "required": true, "location": "path"}, "visibility": {"type": "string", "default": "private", "location": "query"}}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "get": {"id": "drive.properties.get", "path": "files/{fileId}/properties/{propertyKey}", "httpMethod": "GET", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "propertyKey": {"type": "string", "required": true, "location": "path"}, "visibility": {"type": "string", "default": "private", "location": "query"}}, "response": {"$ref": "Property"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly"]}, "insert": {"id": "drive.properties.insert", "path": "files/{fileId}/properties", "httpMethod": "POST", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Property"}, "response": {"$ref": "Property"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "list": {"id": "drive.properties.list", "path": "files/{fileId}/properties", "httpMethod": "GET", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "PropertyList"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly"]}, "patch": {"id": "drive.properties.patch", "path": "files/{fileId}/properties/{propertyKey}", "httpMethod": "PATCH", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "propertyKey": {"type": "string", "required": true, "location": "path"}, "visibility": {"type": "string", "default": "private", "location": "query"}}, "request": {"$ref": "Property"}, "response": {"$ref": "Property"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "update": {"id": "drive.properties.update", "path": "files/{fileId}/properties/{propertyKey}", "httpMethod": "PUT", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "propertyKey": {"type": "string", "required": true, "location": "path"}, "visibility": {"type": "string", "default": "private", "location": "query"}}, "request": {"$ref": "Property"}, "response": {"$ref": "Property"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}}}', true));
- $this->replies = new Google_RepliesServiceResource($this, $this->serviceName, 'replies', json_decode('{"methods": {"delete": {"id": "drive.replies.delete", "path": "files/{fileId}/comments/{commentId}/replies/{replyId}", "httpMethod": "DELETE", "parameters": {"commentId": {"type": "string", "required": true, "location": "path"}, "fileId": {"type": "string", "required": true, "location": "path"}, "replyId": {"type": "string", "required": true, "location": "path"}}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "get": {"id": "drive.replies.get", "path": "files/{fileId}/comments/{commentId}/replies/{replyId}", "httpMethod": "GET", "parameters": {"commentId": {"type": "string", "required": true, "location": "path"}, "fileId": {"type": "string", "required": true, "location": "path"}, "includeDeleted": {"type": "boolean", "default": "false", "location": "query"}, "replyId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "CommentReply"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.readonly"]}, "insert": {"id": "drive.replies.insert", "path": "files/{fileId}/comments/{commentId}/replies", "httpMethod": "POST", "parameters": {"commentId": {"type": "string", "required": true, "location": "path"}, "fileId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "CommentReply"}, "response": {"$ref": "CommentReply"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "list": {"id": "drive.replies.list", "path": "files/{fileId}/comments/{commentId}/replies", "httpMethod": "GET", "parameters": {"commentId": {"type": "string", "required": true, "location": "path"}, "fileId": {"type": "string", "required": true, "location": "path"}, "includeDeleted": {"type": "boolean", "default": "false", "location": "query"}, "maxResults": {"type": "integer", "default": "20", "format": "int32", "minimum": "0", "maximum": "100", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "CommentReplyList"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.readonly"]}, "patch": {"id": "drive.replies.patch", "path": "files/{fileId}/comments/{commentId}/replies/{replyId}", "httpMethod": "PATCH", "parameters": {"commentId": {"type": "string", "required": true, "location": "path"}, "fileId": {"type": "string", "required": true, "location": "path"}, "replyId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "CommentReply"}, "response": {"$ref": "CommentReply"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "update": {"id": "drive.replies.update", "path": "files/{fileId}/comments/{commentId}/replies/{replyId}", "httpMethod": "PUT", "parameters": {"commentId": {"type": "string", "required": true, "location": "path"}, "fileId": {"type": "string", "required": true, "location": "path"}, "replyId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "CommentReply"}, "response": {"$ref": "CommentReply"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}}}', true));
- $this->revisions = new Google_RevisionsServiceResource($this, $this->serviceName, 'revisions', json_decode('{"methods": {"delete": {"id": "drive.revisions.delete", "path": "files/{fileId}/revisions/{revisionId}", "httpMethod": "DELETE", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "revisionId": {"type": "string", "required": true, "location": "path"}}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "get": {"id": "drive.revisions.get", "path": "files/{fileId}/revisions/{revisionId}", "httpMethod": "GET", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "revisionId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "Revision"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly"]}, "list": {"id": "drive.revisions.list", "path": "files/{fileId}/revisions", "httpMethod": "GET", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "RevisionList"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly"]}, "patch": {"id": "drive.revisions.patch", "path": "files/{fileId}/revisions/{revisionId}", "httpMethod": "PATCH", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "revisionId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Revision"}, "response": {"$ref": "Revision"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}, "update": {"id": "drive.revisions.update", "path": "files/{fileId}/revisions/{revisionId}", "httpMethod": "PUT", "parameters": {"fileId": {"type": "string", "required": true, "location": "path"}, "revisionId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Revision"}, "response": {"$ref": "Revision"}, "scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"]}}}', true));
-
- }
-}
-
-
-
-class Google_About extends Google_Model {
- protected $__additionalRoleInfoType = 'Google_AboutAdditionalRoleInfo';
- protected $__additionalRoleInfoDataType = 'array';
- public $additionalRoleInfo;
- public $domainSharingPolicy;
- public $etag;
- protected $__exportFormatsType = 'Google_AboutExportFormats';
- protected $__exportFormatsDataType = 'array';
- public $exportFormats;
- protected $__featuresType = 'Google_AboutFeatures';
- protected $__featuresDataType = 'array';
- public $features;
- protected $__importFormatsType = 'Google_AboutImportFormats';
- protected $__importFormatsDataType = 'array';
- public $importFormats;
- public $isCurrentAppInstalled;
- public $kind;
- public $largestChangeId;
- protected $__maxUploadSizesType = 'Google_AboutMaxUploadSizes';
- protected $__maxUploadSizesDataType = 'array';
- public $maxUploadSizes;
- public $name;
- public $permissionId;
- public $quotaBytesTotal;
- public $quotaBytesUsed;
- public $quotaBytesUsedAggregate;
- public $quotaBytesUsedInTrash;
- public $remainingChangeIds;
- public $rootFolderId;
- public $selfLink;
- protected $__userType = 'Google_User';
- protected $__userDataType = '';
- public $user;
- public function setAdditionalRoleInfo(/* array(Google_AboutAdditionalRoleInfo) */ $additionalRoleInfo) {
- $this->assertIsArray($additionalRoleInfo, 'Google_AboutAdditionalRoleInfo', __METHOD__);
- $this->additionalRoleInfo = $additionalRoleInfo;
- }
- public function getAdditionalRoleInfo() {
- return $this->additionalRoleInfo;
- }
- public function setDomainSharingPolicy($domainSharingPolicy) {
- $this->domainSharingPolicy = $domainSharingPolicy;
- }
- public function getDomainSharingPolicy() {
- return $this->domainSharingPolicy;
- }
- public function setEtag($etag) {
- $this->etag = $etag;
- }
- public function getEtag() {
- return $this->etag;
- }
- public function setExportFormats(/* array(Google_AboutExportFormats) */ $exportFormats) {
- $this->assertIsArray($exportFormats, 'Google_AboutExportFormats', __METHOD__);
- $this->exportFormats = $exportFormats;
- }
- public function getExportFormats() {
- return $this->exportFormats;
- }
- public function setFeatures(/* array(Google_AboutFeatures) */ $features) {
- $this->assertIsArray($features, 'Google_AboutFeatures', __METHOD__);
- $this->features = $features;
- }
- public function getFeatures() {
- return $this->features;
- }
- public function setImportFormats(/* array(Google_AboutImportFormats) */ $importFormats) {
- $this->assertIsArray($importFormats, 'Google_AboutImportFormats', __METHOD__);
- $this->importFormats = $importFormats;
- }
- public function getImportFormats() {
- return $this->importFormats;
- }
- public function setIsCurrentAppInstalled($isCurrentAppInstalled) {
- $this->isCurrentAppInstalled = $isCurrentAppInstalled;
- }
- public function getIsCurrentAppInstalled() {
- return $this->isCurrentAppInstalled;
- }
- public function setKind($kind) {
- $this->kind = $kind;
- }
- public function getKind() {
- return $this->kind;
- }
- public function setLargestChangeId($largestChangeId) {
- $this->largestChangeId = $largestChangeId;
- }
- public function getLargestChangeId() {
- return $this->largestChangeId;
- }
- public function setMaxUploadSizes(/* array(Google_AboutMaxUploadSizes) */ $maxUploadSizes) {
- $this->assertIsArray($maxUploadSizes, 'Google_AboutMaxUploadSizes', __METHOD__);
- $this->maxUploadSizes = $maxUploadSizes;
- }
- public function getMaxUploadSizes() {
- return $this->maxUploadSizes;
- }
- public function setName($name) {
- $this->name = $name;
- }
- public function getName() {
- return $this->name;
- }
- public function setPermissionId($permissionId) {
- $this->permissionId = $permissionId;
- }
- public function getPermissionId() {
- return $this->permissionId;
- }
- public function setQuotaBytesTotal($quotaBytesTotal) {
- $this->quotaBytesTotal = $quotaBytesTotal;
- }
- public function getQuotaBytesTotal() {
- return $this->quotaBytesTotal;
- }
- public function setQuotaBytesUsed($quotaBytesUsed) {
- $this->quotaBytesUsed = $quotaBytesUsed;
- }
- public function getQuotaBytesUsed() {
- return $this->quotaBytesUsed;
- }
- public function setQuotaBytesUsedAggregate($quotaBytesUsedAggregate) {
- $this->quotaBytesUsedAggregate = $quotaBytesUsedAggregate;
- }
- public function getQuotaBytesUsedAggregate() {
- return $this->quotaBytesUsedAggregate;
- }
- public function setQuotaBytesUsedInTrash($quotaBytesUsedInTrash) {
- $this->quotaBytesUsedInTrash = $quotaBytesUsedInTrash;
- }
- public function getQuotaBytesUsedInTrash() {
- return $this->quotaBytesUsedInTrash;
- }
- public function setRemainingChangeIds($remainingChangeIds) {
- $this->remainingChangeIds = $remainingChangeIds;
- }
- public function getRemainingChangeIds() {
- return $this->remainingChangeIds;
- }
- public function setRootFolderId($rootFolderId) {
- $this->rootFolderId = $rootFolderId;
- }
- public function getRootFolderId() {
- return $this->rootFolderId;
- }
- public function setSelfLink($selfLink) {
- $this->selfLink = $selfLink;
- }
- public function getSelfLink() {
- return $this->selfLink;
- }
- public function setUser(Google_User $user) {
- $this->user = $user;
- }
- public function getUser() {
- return $this->user;
- }
-}
-
-class Google_AboutAdditionalRoleInfo extends Google_Model {
- protected $__roleSetsType = 'Google_AboutAdditionalRoleInfoRoleSets';
- protected $__roleSetsDataType = 'array';
- public $roleSets;
- public $type;
- public function setRoleSets(/* array(Google_AboutAdditionalRoleInfoRoleSets) */ $roleSets) {
- $this->assertIsArray($roleSets, 'Google_AboutAdditionalRoleInfoRoleSets', __METHOD__);
- $this->roleSets = $roleSets;
- }
- public function getRoleSets() {
- return $this->roleSets;
- }
- public function setType($type) {
- $this->type = $type;
- }
- public function getType() {
- return $this->type;
- }
-}
-
-class Google_AboutAdditionalRoleInfoRoleSets extends Google_Model {
- public $additionalRoles;
- public $primaryRole;
- public function setAdditionalRoles(/* array(Google_string) */ $additionalRoles) {
- $this->assertIsArray($additionalRoles, 'Google_string', __METHOD__);
- $this->additionalRoles = $additionalRoles;
- }
- public function getAdditionalRoles() {
- return $this->additionalRoles;
- }
- public function setPrimaryRole($primaryRole) {
- $this->primaryRole = $primaryRole;
- }
- public function getPrimaryRole() {
- return $this->primaryRole;
- }
-}
-
-class Google_AboutExportFormats extends Google_Model {
- public $source;
- public $targets;
- public function setSource($source) {
- $this->source = $source;
- }
- public function getSource() {
- return $this->source;
- }
- public function setTargets(/* array(Google_string) */ $targets) {
- $this->assertIsArray($targets, 'Google_string', __METHOD__);
- $this->targets = $targets;
- }
- public function getTargets() {
- return $this->targets;
- }
-}
-
-class Google_AboutFeatures extends Google_Model {
- public $featureName;
- public $featureRate;
- public function setFeatureName($featureName) {
- $this->featureName = $featureName;
- }
- public function getFeatureName() {
- return $this->featureName;
- }
- public function setFeatureRate($featureRate) {
- $this->featureRate = $featureRate;
- }
- public function getFeatureRate() {
- return $this->featureRate;
- }
-}
-
-class Google_AboutImportFormats extends Google_Model {
- public $source;
- public $targets;
- public function setSource($source) {
- $this->source = $source;
- }
- public function getSource() {
- return $this->source;
- }
- public function setTargets(/* array(Google_string) */ $targets) {
- $this->assertIsArray($targets, 'Google_string', __METHOD__);
- $this->targets = $targets;
- }
- public function getTargets() {
- return $this->targets;
- }
-}
-
-class Google_AboutMaxUploadSizes extends Google_Model {
- public $size;
- public $type;
- public function setSize($size) {
- $this->size = $size;
- }
- public function getSize() {
- return $this->size;
- }
- public function setType($type) {
- $this->type = $type;
- }
- public function getType() {
- return $this->type;
- }
-}
-
-class Google_App extends Google_Model {
- public $authorized;
- protected $__iconsType = 'Google_AppIcons';
- protected $__iconsDataType = 'array';
- public $icons;
- public $id;
- public $installed;
- public $kind;
- public $name;
- public $objectType;
- public $primaryFileExtensions;
- public $primaryMimeTypes;
- public $productUrl;
- public $secondaryFileExtensions;
- public $secondaryMimeTypes;
- public $supportsCreate;
- public $supportsImport;
- public $useByDefault;
- public function setAuthorized($authorized) {
- $this->authorized = $authorized;
- }
- public function getAuthorized() {
- return $this->authorized;
- }
- public function setIcons(/* array(Google_AppIcons) */ $icons) {
- $this->assertIsArray($icons, 'Google_AppIcons', __METHOD__);
- $this->icons = $icons;
- }
- public function getIcons() {
- return $this->icons;
- }
- public function setId($id) {
- $this->id = $id;
- }
- public function getId() {
- return $this->id;
- }
- public function setInstalled($installed) {
- $this->installed = $installed;
- }
- public function getInstalled() {
- return $this->installed;
- }
- public function setKind($kind) {
- $this->kind = $kind;
- }
- public function getKind() {
- return $this->kind;
- }
- public function setName($name) {
- $this->name = $name;
- }
- public function getName() {
- return $this->name;
- }
- public function setObjectType($objectType) {
- $this->objectType = $objectType;
- }
- public function getObjectType() {
- return $this->objectType;
- }
- public function setPrimaryFileExtensions(/* array(Google_string) */ $primaryFileExtensions) {
- $this->assertIsArray($primaryFileExtensions, 'Google_string', __METHOD__);
- $this->primaryFileExtensions = $primaryFileExtensions;
- }
- public function getPrimaryFileExtensions() {
- return $this->primaryFileExtensions;
- }
- public function setPrimaryMimeTypes(/* array(Google_string) */ $primaryMimeTypes) {
- $this->assertIsArray($primaryMimeTypes, 'Google_string', __METHOD__);
- $this->primaryMimeTypes = $primaryMimeTypes;
- }
- public function getPrimaryMimeTypes() {
- return $this->primaryMimeTypes;
- }
- public function setProductUrl($productUrl) {
- $this->productUrl = $productUrl;
- }
- public function getProductUrl() {
- return $this->productUrl;
- }
- public function setSecondaryFileExtensions(/* array(Google_string) */ $secondaryFileExtensions) {
- $this->assertIsArray($secondaryFileExtensions, 'Google_string', __METHOD__);
- $this->secondaryFileExtensions = $secondaryFileExtensions;
- }
- public function getSecondaryFileExtensions() {
- return $this->secondaryFileExtensions;
- }
- public function setSecondaryMimeTypes(/* array(Google_string) */ $secondaryMimeTypes) {
- $this->assertIsArray($secondaryMimeTypes, 'Google_string', __METHOD__);
- $this->secondaryMimeTypes = $secondaryMimeTypes;
- }
- public function getSecondaryMimeTypes() {
- return $this->secondaryMimeTypes;
- }
- public function setSupportsCreate($supportsCreate) {
- $this->supportsCreate = $supportsCreate;
- }
- public function getSupportsCreate() {
- return $this->supportsCreate;
- }
- public function setSupportsImport($supportsImport) {
- $this->supportsImport = $supportsImport;
- }
- public function getSupportsImport() {
- return $this->supportsImport;
- }
- public function setUseByDefault($useByDefault) {
- $this->useByDefault = $useByDefault;
- }
- public function getUseByDefault() {
- return $this->useByDefault;
- }
-}
-
-class Google_AppIcons extends Google_Model {
- public $category;
- public $iconUrl;
- public $size;
- public function setCategory($category) {
- $this->category = $category;
- }
- public function getCategory() {
- return $this->category;
- }
- public function setIconUrl($iconUrl) {
- $this->iconUrl = $iconUrl;
- }
- public function getIconUrl() {
- return $this->iconUrl;
- }
- public function setSize($size) {
- $this->size = $size;
- }
- public function getSize() {
- return $this->size;
- }
-}
-
-class Google_AppList extends Google_Model {
- public $etag;
- protected $__itemsType = 'Google_App';
- protected $__itemsDataType = 'array';
- public $items;
- public $kind;
- public $selfLink;
- public function setEtag($etag) {
- $this->etag = $etag;
- }
- public function getEtag() {
- return $this->etag;
- }
- public function setItems(/* array(Google_App) */ $items) {
- $this->assertIsArray($items, 'Google_App', __METHOD__);
- $this->items = $items;
- }
- public function getItems() {
- return $this->items;
- }
- public function setKind($kind) {
- $this->kind = $kind;
- }
- public function getKind() {
- return $this->kind;
- }
- public function setSelfLink($selfLink) {
- $this->selfLink = $selfLink;
- }
- public function getSelfLink() {
- return $this->selfLink;
- }
-}
-
-class Google_Change extends Google_Model {
- public $deleted;
- protected $__fileType = 'Google_DriveFile';
- protected $__fileDataType = '';
- public $file;
- public $fileId;
- public $id;
- public $kind;
- public $selfLink;
- public function setDeleted($deleted) {
- $this->deleted = $deleted;
- }
- public function getDeleted() {
- return $this->deleted;
- }
- public function setFile(Google_DriveFile $file) {
- $this->file = $file;
- }
- public function getFile() {
- return $this->file;
- }
- public function setFileId($fileId) {
- $this->fileId = $fileId;
- }
- public function getFileId() {
- return $this->fileId;
- }
- public function setId($id) {
- $this->id = $id;
- }
- public function getId() {
- return $this->id;
- }
- public function setKind($kind) {
- $this->kind = $kind;
- }
- public function getKind() {
- return $this->kind;
- }
- public function setSelfLink($selfLink) {
- $this->selfLink = $selfLink;
- }
- public function getSelfLink() {
- return $this->selfLink;
- }
-}
-
-class Google_ChangeList extends Google_Model {
- public $etag;
- protected $__itemsType = 'Google_Change';
- protected $__itemsDataType = 'array';
- public $items;
- public $kind;
- public $largestChangeId;
- public $nextLink;
- public $nextPageToken;
- public $selfLink;
- public function setEtag($etag) {
- $this->etag = $etag;
- }
- public function getEtag() {
- return $this->etag;
- }
- public function setItems(/* array(Google_Change) */ $items) {
- $this->assertIsArray($items, 'Google_Change', __METHOD__);
- $this->items = $items;
- }
- public function getItems() {
- return $this->items;
- }
- public function setKind($kind) {
- $this->kind = $kind;
- }
- public function getKind() {
- return $this->kind;
- }
- public function setLargestChangeId($largestChangeId) {
- $this->largestChangeId = $largestChangeId;
- }
- public function getLargestChangeId() {
- return $this->largestChangeId;
- }
- public function setNextLink($nextLink) {
- $this->nextLink = $nextLink;
- }
- public function getNextLink() {
- return $this->nextLink;
- }
- public function setNextPageToken($nextPageToken) {
- $this->nextPageToken = $nextPageToken;
- }
- public function getNextPageToken() {
- return $this->nextPageToken;
- }
- public function setSelfLink($selfLink) {
- $this->selfLink = $selfLink;
- }
- public function getSelfLink() {
- return $this->selfLink;
- }
-}
-
-class Google_ChildList extends Google_Model {
- public $etag;
- protected $__itemsType = 'Google_ChildReference';
- protected $__itemsDataType = 'array';
- public $items;
- public $kind;
- public $nextLink;
- public $nextPageToken;
- public $selfLink;
- public function setEtag($etag) {
- $this->etag = $etag;
- }
- public function getEtag() {
- return $this->etag;
- }
- public function setItems(/* array(Google_ChildReference) */ $items) {
- $this->assertIsArray($items, 'Google_ChildReference', __METHOD__);
- $this->items = $items;
- }
- public function getItems() {
- return $this->items;
- }
- public function setKind($kind) {
- $this->kind = $kind;
- }
- public function getKind() {
- return $this->kind;
- }
- public function setNextLink($nextLink) {
- $this->nextLink = $nextLink;
- }
- public function getNextLink() {
- return $this->nextLink;
- }
- public function setNextPageToken($nextPageToken) {
- $this->nextPageToken = $nextPageToken;
- }
- public function getNextPageToken() {
- return $this->nextPageToken;
- }
- public function setSelfLink($selfLink) {
- $this->selfLink = $selfLink;
- }
- public function getSelfLink() {
- return $this->selfLink;
- }
-}
-
-class Google_ChildReference extends Google_Model {
- public $childLink;
- public $id;
- public $kind;
- public $selfLink;
- public function setChildLink($childLink) {
- $this->childLink = $childLink;
- }
- public function getChildLink() {
- return $this->childLink;
- }
- public function setId($id) {
- $this->id = $id;
- }
- public function getId() {
- return $this->id;
- }
- public function setKind($kind) {
- $this->kind = $kind;
- }
- public function getKind() {
- return $this->kind;
- }
- public function setSelfLink($selfLink) {
- $this->selfLink = $selfLink;
- }
- public function getSelfLink() {
- return $this->selfLink;
- }
-}
-
-class Google_Comment extends Google_Model {
- public $anchor;
- protected $__authorType = 'Google_User';
- protected $__authorDataType = '';
- public $author;
- public $commentId;
- public $content;
- protected $__contextType = 'Google_CommentContext';
- protected $__contextDataType = '';
- public $context;
- public $createdDate;
- public $deleted;
- public $fileId;
- public $fileTitle;
- public $htmlContent;
- public $kind;
- public $modifiedDate;
- protected $__repliesType = 'Google_CommentReply';
- protected $__repliesDataType = 'array';
- public $replies;
- public $selfLink;
- public $status;
- public function setAnchor($anchor) {
- $this->anchor = $anchor;
- }
- public function getAnchor() {
- return $this->anchor;
- }
- public function setAuthor(Google_User $author) {
- $this->author = $author;
- }
- public function getAuthor() {
- return $this->author;
- }
- public function setCommentId($commentId) {
- $this->commentId = $commentId;
- }
- public function getCommentId() {
- return $this->commentId;
- }
- public function setContent($content) {
- $this->content = $content;
- }
- public function getContent() {
- return $this->content;
- }
- public function setContext(Google_CommentContext $context) {
- $this->context = $context;
- }
- public function getContext() {
- return $this->context;
- }
- public function setCreatedDate($createdDate) {
- $this->createdDate = $createdDate;
- }
- public function getCreatedDate() {
- return $this->createdDate;
- }
- public function setDeleted($deleted) {
- $this->deleted = $deleted;
- }
- public function getDeleted() {
- return $this->deleted;
- }
- public function setFileId($fileId) {
- $this->fileId = $fileId;
- }
- public function getFileId() {
- return $this->fileId;
- }
- public function setFileTitle($fileTitle) {
- $this->fileTitle = $fileTitle;
- }
- public function getFileTitle() {
- return $this->fileTitle;
- }
- public function setHtmlContent($htmlContent) {
- $this->htmlContent = $htmlContent;
- }
- public function getHtmlContent() {
- return $this->htmlContent;
- }
- public function setKind($kind) {
- $this->kind = $kind;
- }
- public function getKind() {
- return $this->kind;
- }
- public function setModifiedDate($modifiedDate) {
- $this->modifiedDate = $modifiedDate;
- }
- public function getModifiedDate() {
- return $this->modifiedDate;
- }
- public function setReplies(/* array(Google_CommentReply) */ $replies) {
- $this->assertIsArray($replies, 'Google_CommentReply', __METHOD__);
- $this->replies = $replies;
- }
- public function getReplies() {
- return $this->replies;
- }
- public function setSelfLink($selfLink) {
- $this->selfLink = $selfLink;
- }
- public function getSelfLink() {
- return $this->selfLink;
- }
- public function setStatus($status) {
- $this->status = $status;
- }
- public function getStatus() {
- return $this->status;
- }
-}
-
-class Google_CommentContext extends Google_Model {
- public $type;
- public $value;
- public function setType($type) {
- $this->type = $type;
- }
- public function getType() {
- return $this->type;
- }
- public function setValue($value) {
- $this->value = $value;
- }
- public function getValue() {
- return $this->value;
- }
-}
-
-class Google_CommentList extends Google_Model {
- protected $__itemsType = 'Google_Comment';
- protected $__itemsDataType = 'array';
- public $items;
- public $kind;
- public $nextPageToken;
- public function setItems(/* array(Google_Comment) */ $items) {
- $this->assertIsArray($items, 'Google_Comment', __METHOD__);
- $this->items = $items;
- }
- public function getItems() {
- return $this->items;
- }
- public function setKind($kind) {
- $this->kind = $kind;
- }
- public function getKind() {
- return $this->kind;
- }
- public function setNextPageToken($nextPageToken) {
- $this->nextPageToken = $nextPageToken;
- }
- public function getNextPageToken() {
- return $this->nextPageToken;
- }
-}
-
-class Google_CommentReply extends Google_Model {
- protected $__authorType = 'Google_User';
- protected $__authorDataType = '';
- public $author;
- public $content;
- public $createdDate;
- public $deleted;
- public $htmlContent;
- public $kind;
- public $modifiedDate;
- public $replyId;
- public $verb;
- public function setAuthor(Google_User $author) {
- $this->author = $author;
- }
- public function getAuthor() {
- return $this->author;
- }
- public function setContent($content) {
- $this->content = $content;
- }
- public function getContent() {
- return $this->content;
- }
- public function setCreatedDate($createdDate) {
- $this->createdDate = $createdDate;
- }
- public function getCreatedDate() {
- return $this->createdDate;
- }
- public function setDeleted($deleted) {
- $this->deleted = $deleted;
- }
- public function getDeleted() {
- return $this->deleted;
- }
- public function setHtmlContent($htmlContent) {
- $this->htmlContent = $htmlContent;
- }
- public function getHtmlContent() {
- return $this->htmlContent;
- }
- public function setKind($kind) {
- $this->kind = $kind;
- }
- public function getKind() {
- return $this->kind;
- }
- public function setModifiedDate($modifiedDate) {
- $this->modifiedDate = $modifiedDate;
- }
- public function getModifiedDate() {
- return $this->modifiedDate;
- }
- public function setReplyId($replyId) {
- $this->replyId = $replyId;
- }
- public function getReplyId() {
- return $this->replyId;
- }
- public function setVerb($verb) {
- $this->verb = $verb;
- }
- public function getVerb() {
- return $this->verb;
- }
-}
-
-class Google_CommentReplyList extends Google_Model {
- protected $__itemsType = 'Google_CommentReply';
- protected $__itemsDataType = 'array';
- public $items;
- public $kind;
- public $nextPageToken;
- public function setItems(/* array(Google_CommentReply) */ $items) {
- $this->assertIsArray($items, 'Google_CommentReply', __METHOD__);
- $this->items = $items;
- }
- public function getItems() {
- return $this->items;
- }
- public function setKind($kind) {
- $this->kind = $kind;
- }
- public function getKind() {
- return $this->kind;
- }
- public function setNextPageToken($nextPageToken) {
- $this->nextPageToken = $nextPageToken;
- }
- public function getNextPageToken() {
- return $this->nextPageToken;
- }
-}
-
-class Google_DriveFile extends Google_Model {
- public $alternateLink;
- public $appDataContents;
- public $createdDate;
- public $description;
- public $downloadUrl;
- public $editable;
- public $embedLink;
- public $etag;
- public $explicitlyTrashed;
- public $exportLinks;
- public $fileExtension;
- public $fileSize;
- public $iconLink;
- public $id;
- protected $__imageMediaMetadataType = 'Google_DriveFileImageMediaMetadata';
- protected $__imageMediaMetadataDataType = '';
- public $imageMediaMetadata;
- protected $__indexableTextType = 'Google_DriveFileIndexableText';
- protected $__indexableTextDataType = '';
- public $indexableText;
- public $kind;
- protected $__labelsType = 'Google_DriveFileLabels';
- protected $__labelsDataType = '';
- public $labels;
- protected $__lastModifyingUserType = 'Google_User';
- protected $__lastModifyingUserDataType = '';
- public $lastModifyingUser;
- public $lastModifyingUserName;
- public $lastViewedByMeDate;
- public $md5Checksum;
- public $mimeType;
- public $modifiedByMeDate;
- public $modifiedDate;
- public $originalFilename;
- public $ownerNames;
- protected $__ownersType = 'Google_User';
- protected $__ownersDataType = 'array';
- public $owners;
- protected $__parentsType = 'Google_ParentReference';
- protected $__parentsDataType = 'array';
- public $parents;
- public $quotaBytesUsed;
- public $selfLink;
- public $shared;
- public $sharedWithMeDate;
- protected $__thumbnailType = 'Google_DriveFileThumbnail';
- protected $__thumbnailDataType = '';
- public $thumbnail;
- public $thumbnailLink;
- public $title;
- protected $__userPermissionType = 'Google_Permission';
- protected $__userPermissionDataType = '';
- public $userPermission;
- public $webContentLink;
- public $webViewLink;
- public $writersCanShare;
- public function setAlternateLink($alternateLink) {
- $this->alternateLink = $alternateLink;
- }
- public function getAlternateLink() {
- return $this->alternateLink;
- }
- public function setAppDataContents($appDataContents) {
- $this->appDataContents = $appDataContents;
- }
- public function getAppDataContents() {
- return $this->appDataContents;
- }
- public function setCreatedDate($createdDate) {
- $this->createdDate = $createdDate;
- }
- public function getCreatedDate() {
- return $this->createdDate;
- }
- public function setDescription($description) {
- $this->description = $description;
- }
- public function getDescription() {
- return $this->description;
- }
- public function setDownloadUrl($downloadUrl) {
- $this->downloadUrl = $downloadUrl;
- }
- public function getDownloadUrl() {
- return $this->downloadUrl;
- }
- public function setEditable($editable) {
- $this->editable = $editable;
- }
- public function getEditable() {
- return $this->editable;
- }
- public function setEmbedLink($embedLink) {
- $this->embedLink = $embedLink;
- }
- public function getEmbedLink() {
- return $this->embedLink;
- }
- public function setEtag($etag) {
- $this->etag = $etag;
- }
- public function getEtag() {
- return $this->etag;
- }
- public function setExplicitlyTrashed($explicitlyTrashed) {
- $this->explicitlyTrashed = $explicitlyTrashed;
- }
- public function getExplicitlyTrashed() {
- return $this->explicitlyTrashed;
- }
- public function setExportLinks($exportLinks) {
- $this->exportLinks = $exportLinks;
- }
- public function getExportLinks() {
- return $this->exportLinks;
- }
- public function setFileExtension($fileExtension) {
- $this->fileExtension = $fileExtension;
- }
- public function getFileExtension() {
- return $this->fileExtension;
- }
- public function setFileSize($fileSize) {
- $this->fileSize = $fileSize;
- }
- public function getFileSize() {
- return $this->fileSize;
- }
- public function setIconLink($iconLink) {
- $this->iconLink = $iconLink;
- }
- public function getIconLink() {
- return $this->iconLink;
- }
- public function setId($id) {
- $this->id = $id;
- }
- public function getId() {
- return $this->id;
- }
- public function setImageMediaMetadata(Google_DriveFileImageMediaMetadata $imageMediaMetadata) {
- $this->imageMediaMetadata = $imageMediaMetadata;
- }
- public function getImageMediaMetadata() {
- return $this->imageMediaMetadata;
- }
- public function setIndexableText(Google_DriveFileIndexableText $indexableText) {
- $this->indexableText = $indexableText;
- }
- public function getIndexableText() {
- return $this->indexableText;
- }
- public function setKind($kind) {
- $this->kind = $kind;
- }
- public function getKind() {
- return $this->kind;
- }
- public function setLabels(Google_DriveFileLabels $labels) {
- $this->labels = $labels;
- }
- public function getLabels() {
- return $this->labels;
- }
- public function setLastModifyingUser(Google_User $lastModifyingUser) {
- $this->lastModifyingUser = $lastModifyingUser;
- }
- public function getLastModifyingUser() {
- return $this->lastModifyingUser;
- }
- public function setLastModifyingUserName($lastModifyingUserName) {
- $this->lastModifyingUserName = $lastModifyingUserName;
- }
- public function getLastModifyingUserName() {
- return $this->lastModifyingUserName;
- }
- public function setLastViewedByMeDate($lastViewedByMeDate) {
- $this->lastViewedByMeDate = $lastViewedByMeDate;
- }
- public function getLastViewedByMeDate() {
- return $this->lastViewedByMeDate;
- }
- public function setMd5Checksum($md5Checksum) {
- $this->md5Checksum = $md5Checksum;
- }
- public function getMd5Checksum() {
- return $this->md5Checksum;
- }
- public function setMimeType($mimeType) {
- $this->mimeType = $mimeType;
- }
- public function getMimeType() {
- return $this->mimeType;
- }
- public function setModifiedByMeDate($modifiedByMeDate) {
- $this->modifiedByMeDate = $modifiedByMeDate;
- }
- public function getModifiedByMeDate() {
- return $this->modifiedByMeDate;
- }
- public function setModifiedDate($modifiedDate) {
- $this->modifiedDate = $modifiedDate;
- }
- public function getModifiedDate() {
- return $this->modifiedDate;
- }
- public function setOriginalFilename($originalFilename) {
- $this->originalFilename = $originalFilename;
- }
- public function getOriginalFilename() {
- return $this->originalFilename;
- }
- public function setOwnerNames(/* array(Google_string) */ $ownerNames) {
- $this->assertIsArray($ownerNames, 'Google_string', __METHOD__);
- $this->ownerNames = $ownerNames;
- }
- public function getOwnerNames() {
- return $this->ownerNames;
- }
- public function setOwners(/* array(Google_User) */ $owners) {
- $this->assertIsArray($owners, 'Google_User', __METHOD__);
- $this->owners = $owners;
- }
- public function getOwners() {
- return $this->owners;
- }
- public function setParents(/* array(Google_ParentReference) */ $parents) {
- $this->assertIsArray($parents, 'Google_ParentReference', __METHOD__);
- $this->parents = $parents;
- }
- public function getParents() {
- return $this->parents;
- }
- public function setQuotaBytesUsed($quotaBytesUsed) {
- $this->quotaBytesUsed = $quotaBytesUsed;
- }
- public function getQuotaBytesUsed() {
- return $this->quotaBytesUsed;
- }
- public function setSelfLink($selfLink) {
- $this->selfLink = $selfLink;
- }
- public function getSelfLink() {
- return $this->selfLink;
- }
- public function setShared($shared) {
- $this->shared = $shared;
- }
- public function getShared() {
- return $this->shared;
- }
- public function setSharedWithMeDate($sharedWithMeDate) {
- $this->sharedWithMeDate = $sharedWithMeDate;
- }
- public function getSharedWithMeDate() {
- return $this->sharedWithMeDate;
- }
- public function setThumbnail(Google_DriveFileThumbnail $thumbnail) {
- $this->thumbnail = $thumbnail;
- }
- public function getThumbnail() {
- return $this->thumbnail;
- }
- public function setThumbnailLink($thumbnailLink) {
- $this->thumbnailLink = $thumbnailLink;
- }
- public function getThumbnailLink() {
- return $this->thumbnailLink;
- }
- public function setTitle($title) {
- $this->title = $title;
- }
- public function getTitle() {
- return $this->title;
- }
- public function setUserPermission(Google_Permission $userPermission) {
- $this->userPermission = $userPermission;
- }
- public function getUserPermission() {
- return $this->userPermission;
- }
- public function setWebContentLink($webContentLink) {
- $this->webContentLink = $webContentLink;
- }
- public function getWebContentLink() {
- return $this->webContentLink;
- }
- public function setWebViewLink($webViewLink) {
- $this->webViewLink = $webViewLink;
- }
- public function getWebViewLink() {
- return $this->webViewLink;
- }
- public function setWritersCanShare($writersCanShare) {
- $this->writersCanShare = $writersCanShare;
- }
- public function getWritersCanShare() {
- return $this->writersCanShare;
- }
-}
-
-class Google_DriveFileImageMediaMetadata extends Google_Model {
- public $aperture;
- public $cameraMake;
- public $cameraModel;
- public $colorSpace;
- public $date;
- public $exposureBias;
- public $exposureMode;
- public $exposureTime;
- public $flashUsed;
- public $focalLength;
- public $height;
- public $isoSpeed;
- public $lens;
- protected $__locationType = 'Google_DriveFileImageMediaMetadataLocation';
- protected $__locationDataType = '';
- public $location;
- public $maxApertureValue;
- public $meteringMode;
- public $rotation;
- public $sensor;
- public $subjectDistance;
- public $whiteBalance;
- public $width;
- public function setAperture($aperture) {
- $this->aperture = $aperture;
- }
- public function getAperture() {
- return $this->aperture;
- }
- public function setCameraMake($cameraMake) {
- $this->cameraMake = $cameraMake;
- }
- public function getCameraMake() {
- return $this->cameraMake;
- }
- public function setCameraModel($cameraModel) {
- $this->cameraModel = $cameraModel;
- }
- public function getCameraModel() {
- return $this->cameraModel;
- }
- public function setColorSpace($colorSpace) {
- $this->colorSpace = $colorSpace;
- }
- public function getColorSpace() {
- return $this->colorSpace;
- }
- public function setDate($date) {
- $this->date = $date;
- }
- public function getDate() {
- return $this->date;
- }
- public function setExposureBias($exposureBias) {
- $this->exposureBias = $exposureBias;
- }
- public function getExposureBias() {
- return $this->exposureBias;
- }
- public function setExposureMode($exposureMode) {
- $this->exposureMode = $exposureMode;
- }
- public function getExposureMode() {
- return $this->exposureMode;
- }
- public function setExposureTime($exposureTime) {
- $this->exposureTime = $exposureTime;
- }
- public function getExposureTime() {
- return $this->exposureTime;
- }
- public function setFlashUsed($flashUsed) {
- $this->flashUsed = $flashUsed;
- }
- public function getFlashUsed() {
- return $this->flashUsed;
- }
- public function setFocalLength($focalLength) {
- $this->focalLength = $focalLength;
- }
- public function getFocalLength() {
- return $this->focalLength;
- }
- public function setHeight($height) {
- $this->height = $height;
- }
- public function getHeight() {
- return $this->height;
- }
- public function setIsoSpeed($isoSpeed) {
- $this->isoSpeed = $isoSpeed;
- }
- public function getIsoSpeed() {
- return $this->isoSpeed;
- }
- public function setLens($lens) {
- $this->lens = $lens;
- }
- public function getLens() {
- return $this->lens;
- }
- public function setLocation(Google_DriveFileImageMediaMetadataLocation $location) {
- $this->location = $location;
- }
- public function getLocation() {
- return $this->location;
- }
- public function setMaxApertureValue($maxApertureValue) {
- $this->maxApertureValue = $maxApertureValue;
- }
- public function getMaxApertureValue() {
- return $this->maxApertureValue;
- }
- public function setMeteringMode($meteringMode) {
- $this->meteringMode = $meteringMode;
- }
- public function getMeteringMode() {
- return $this->meteringMode;
- }
- public function setRotation($rotation) {
- $this->rotation = $rotation;
- }
- public function getRotation() {
- return $this->rotation;
- }
- public function setSensor($sensor) {
- $this->sensor = $sensor;
- }
- public function getSensor() {
- return $this->sensor;
- }
- public function setSubjectDistance($subjectDistance) {
- $this->subjectDistance = $subjectDistance;
- }
- public function getSubjectDistance() {
- return $this->subjectDistance;
- }
- public function setWhiteBalance($whiteBalance) {
- $this->whiteBalance = $whiteBalance;
- }
- public function getWhiteBalance() {
- return $this->whiteBalance;
- }
- public function setWidth($width) {
- $this->width = $width;
- }
- public function getWidth() {
- return $this->width;
- }
-}
-
-class Google_DriveFileImageMediaMetadataLocation extends Google_Model {
- public $altitude;
- public $latitude;
- public $longitude;
- public function setAltitude($altitude) {
- $this->altitude = $altitude;
- }
- public function getAltitude() {
- return $this->altitude;
- }
- public function setLatitude($latitude) {
- $this->latitude = $latitude;
- }
- public function getLatitude() {
- return $this->latitude;
- }
- public function setLongitude($longitude) {
- $this->longitude = $longitude;
- }
- public function getLongitude() {
- return $this->longitude;
- }
-}
-
-class Google_DriveFileIndexableText extends Google_Model {
- public $text;
- public function setText($text) {
- $this->text = $text;
- }
- public function getText() {
- return $this->text;
- }
-}
-
-class Google_DriveFileLabels extends Google_Model {
- public $hidden;
- public $restricted;
- public $starred;
- public $trashed;
- public $viewed;
- public function setHidden($hidden) {
- $this->hidden = $hidden;
- }
- public function getHidden() {
- return $this->hidden;
- }
- public function setRestricted($restricted) {
- $this->restricted = $restricted;
- }
- public function getRestricted() {
- return $this->restricted;
- }
- public function setStarred($starred) {
- $this->starred = $starred;
- }
- public function getStarred() {
- return $this->starred;
- }
- public function setTrashed($trashed) {
- $this->trashed = $trashed;
- }
- public function getTrashed() {
- return $this->trashed;
- }
- public function setViewed($viewed) {
- $this->viewed = $viewed;
- }
- public function getViewed() {
- return $this->viewed;
- }
-}
-
-class Google_DriveFileThumbnail extends Google_Model {
- public $image;
- public $mimeType;
- public function setImage($image) {
- $this->image = $image;
- }
- public function getImage() {
- return $this->image;
- }
- public function setMimeType($mimeType) {
- $this->mimeType = $mimeType;
- }
- public function getMimeType() {
- return $this->mimeType;
- }
-}
-
-class Google_FileList extends Google_Model {
- public $etag;
- protected $__itemsType = 'Google_DriveFile';
- protected $__itemsDataType = 'array';
- public $items;
- public $kind;
- public $nextLink;
- public $nextPageToken;
- public $selfLink;
- public function setEtag($etag) {
- $this->etag = $etag;
- }
- public function getEtag() {
- return $this->etag;
- }
- public function setItems(/* array(Google_DriveFile) */ $items) {
- $this->assertIsArray($items, 'Google_DriveFile', __METHOD__);
- $this->items = $items;
- }
- public function getItems() {
- return $this->items;
- }
- public function setKind($kind) {
- $this->kind = $kind;
- }
- public function getKind() {
- return $this->kind;
- }
- public function setNextLink($nextLink) {
- $this->nextLink = $nextLink;
- }
- public function getNextLink() {
- return $this->nextLink;
- }
- public function setNextPageToken($nextPageToken) {
- $this->nextPageToken = $nextPageToken;
- }
- public function getNextPageToken() {
- return $this->nextPageToken;
- }
- public function setSelfLink($selfLink) {
- $this->selfLink = $selfLink;
- }
- public function getSelfLink() {
- return $this->selfLink;
- }
-}
-
-class Google_ParentList extends Google_Model {
- public $etag;
- protected $__itemsType = 'Google_ParentReference';
- protected $__itemsDataType = 'array';
- public $items;
- public $kind;
- public $selfLink;
- public function setEtag($etag) {
- $this->etag = $etag;
- }
- public function getEtag() {
- return $this->etag;
- }
- public function setItems(/* array(Google_ParentReference) */ $items) {
- $this->assertIsArray($items, 'Google_ParentReference', __METHOD__);
- $this->items = $items;
- }
- public function getItems() {
- return $this->items;
- }
- public function setKind($kind) {
- $this->kind = $kind;
- }
- public function getKind() {
- return $this->kind;
- }
- public function setSelfLink($selfLink) {
- $this->selfLink = $selfLink;
- }
- public function getSelfLink() {
- return $this->selfLink;
- }
-}
-
-class Google_ParentReference extends Google_Model {
- public $id;
- public $isRoot;
- public $kind;
- public $parentLink;
- public $selfLink;
- public function setId($id) {
- $this->id = $id;
- }
- public function getId() {
- return $this->id;
- }
- public function setIsRoot($isRoot) {
- $this->isRoot = $isRoot;
- }
- public function getIsRoot() {
- return $this->isRoot;
- }
- public function setKind($kind) {
- $this->kind = $kind;
- }
- public function getKind() {
- return $this->kind;
- }
- public function setParentLink($parentLink) {
- $this->parentLink = $parentLink;
- }
- public function getParentLink() {
- return $this->parentLink;
- }
- public function setSelfLink($selfLink) {
- $this->selfLink = $selfLink;
- }
- public function getSelfLink() {
- return $this->selfLink;
- }
-}
-
-class Google_Permission extends Google_Model {
- public $additionalRoles;
- public $authKey;
- public $etag;
- public $id;
- public $kind;
- public $name;
- public $photoLink;
- public $role;
- public $selfLink;
- public $type;
- public $value;
- public $withLink;
- public function setAdditionalRoles(/* array(Google_string) */ $additionalRoles) {
- $this->assertIsArray($additionalRoles, 'Google_string', __METHOD__);
- $this->additionalRoles = $additionalRoles;
- }
- public function getAdditionalRoles() {
- return $this->additionalRoles;
- }
- public function setAuthKey($authKey) {
- $this->authKey = $authKey;
- }
- public function getAuthKey() {
- return $this->authKey;
- }
- public function setEtag($etag) {
- $this->etag = $etag;
- }
- public function getEtag() {
- return $this->etag;
- }
- public function setId($id) {
- $this->id = $id;
- }
- public function getId() {
- return $this->id;
- }
- public function setKind($kind) {
- $this->kind = $kind;
- }
- public function getKind() {
- return $this->kind;
- }
- public function setName($name) {
- $this->name = $name;
- }
- public function getName() {
- return $this->name;
- }
- public function setPhotoLink($photoLink) {
- $this->photoLink = $photoLink;
- }
- public function getPhotoLink() {
- return $this->photoLink;
- }
- public function setRole($role) {
- $this->role = $role;
- }
- public function getRole() {
- return $this->role;
- }
- public function setSelfLink($selfLink) {
- $this->selfLink = $selfLink;
- }
- public function getSelfLink() {
- return $this->selfLink;
- }
- public function setType($type) {
- $this->type = $type;
- }
- public function getType() {
- return $this->type;
- }
- public function setValue($value) {
- $this->value = $value;
- }
- public function getValue() {
- return $this->value;
- }
- public function setWithLink($withLink) {
- $this->withLink = $withLink;
- }
- public function getWithLink() {
- return $this->withLink;
- }
-}
-
-class Google_PermissionList extends Google_Model {
- public $etag;
- protected $__itemsType = 'Google_Permission';
- protected $__itemsDataType = 'array';
- public $items;
- public $kind;
- public $selfLink;
- public function setEtag($etag) {
- $this->etag = $etag;
- }
- public function getEtag() {
- return $this->etag;
- }
- public function setItems(/* array(Google_Permission) */ $items) {
- $this->assertIsArray($items, 'Google_Permission', __METHOD__);
- $this->items = $items;
- }
- public function getItems() {
- return $this->items;
- }
- public function setKind($kind) {
- $this->kind = $kind;
- }
- public function getKind() {
- return $this->kind;
- }
- public function setSelfLink($selfLink) {
- $this->selfLink = $selfLink;
- }
- public function getSelfLink() {
- return $this->selfLink;
- }
-}
-
-class Google_Property extends Google_Model {
- public $etag;
- public $key;
- public $kind;
- public $selfLink;
- public $value;
- public $visibility;
- public function setEtag($etag) {
- $this->etag = $etag;
- }
- public function getEtag() {
- return $this->etag;
- }
- public function setKey($key) {
- $this->key = $key;
- }
- public function getKey() {
- return $this->key;
- }
- public function setKind($kind) {
- $this->kind = $kind;
- }
- public function getKind() {
- return $this->kind;
- }
- public function setSelfLink($selfLink) {
- $this->selfLink = $selfLink;
- }
- public function getSelfLink() {
- return $this->selfLink;
- }
- public function setValue($value) {
- $this->value = $value;
- }
- public function getValue() {
- return $this->value;
- }
- public function setVisibility($visibility) {
- $this->visibility = $visibility;
- }
- public function getVisibility() {
- return $this->visibility;
- }
-}
-
-class Google_PropertyList extends Google_Model {
- public $etag;
- protected $__itemsType = 'Google_Property';
- protected $__itemsDataType = 'array';
- public $items;
- public $kind;
- public $selfLink;
- public function setEtag($etag) {
- $this->etag = $etag;
- }
- public function getEtag() {
- return $this->etag;
- }
- public function setItems(/* array(Google_Property) */ $items) {
- $this->assertIsArray($items, 'Google_Property', __METHOD__);
- $this->items = $items;
- }
- public function getItems() {
- return $this->items;
- }
- public function setKind($kind) {
- $this->kind = $kind;
- }
- public function getKind() {
- return $this->kind;
- }
- public function setSelfLink($selfLink) {
- $this->selfLink = $selfLink;
- }
- public function getSelfLink() {
- return $this->selfLink;
- }
-}
-
-class Google_Revision extends Google_Model {
- public $downloadUrl;
- public $etag;
- public $exportLinks;
- public $fileSize;
- public $id;
- public $kind;
- protected $__lastModifyingUserType = 'Google_User';
- protected $__lastModifyingUserDataType = '';
- public $lastModifyingUser;
- public $lastModifyingUserName;
- public $md5Checksum;
- public $mimeType;
- public $modifiedDate;
- public $originalFilename;
- public $pinned;
- public $publishAuto;
- public $published;
- public $publishedLink;
- public $publishedOutsideDomain;
- public $selfLink;
- public function setDownloadUrl($downloadUrl) {
- $this->downloadUrl = $downloadUrl;
- }
- public function getDownloadUrl() {
- return $this->downloadUrl;
- }
- public function setEtag($etag) {
- $this->etag = $etag;
- }
- public function getEtag() {
- return $this->etag;
- }
- public function setExportLinks($exportLinks) {
- $this->exportLinks = $exportLinks;
- }
- public function getExportLinks() {
- return $this->exportLinks;
- }
- public function setFileSize($fileSize) {
- $this->fileSize = $fileSize;
- }
- public function getFileSize() {
- return $this->fileSize;
- }
- public function setId($id) {
- $this->id = $id;
- }
- public function getId() {
- return $this->id;
- }
- public function setKind($kind) {
- $this->kind = $kind;
- }
- public function getKind() {
- return $this->kind;
- }
- public function setLastModifyingUser(Google_User $lastModifyingUser) {
- $this->lastModifyingUser = $lastModifyingUser;
- }
- public function getLastModifyingUser() {
- return $this->lastModifyingUser;
- }
- public function setLastModifyingUserName($lastModifyingUserName) {
- $this->lastModifyingUserName = $lastModifyingUserName;
- }
- public function getLastModifyingUserName() {
- return $this->lastModifyingUserName;
- }
- public function setMd5Checksum($md5Checksum) {
- $this->md5Checksum = $md5Checksum;
- }
- public function getMd5Checksum() {
- return $this->md5Checksum;
- }
- public function setMimeType($mimeType) {
- $this->mimeType = $mimeType;
- }
- public function getMimeType() {
- return $this->mimeType;
- }
- public function setModifiedDate($modifiedDate) {
- $this->modifiedDate = $modifiedDate;
- }
- public function getModifiedDate() {
- return $this->modifiedDate;
- }
- public function setOriginalFilename($originalFilename) {
- $this->originalFilename = $originalFilename;
- }
- public function getOriginalFilename() {
- return $this->originalFilename;
- }
- public function setPinned($pinned) {
- $this->pinned = $pinned;
- }
- public function getPinned() {
- return $this->pinned;
- }
- public function setPublishAuto($publishAuto) {
- $this->publishAuto = $publishAuto;
- }
- public function getPublishAuto() {
- return $this->publishAuto;
- }
- public function setPublished($published) {
- $this->published = $published;
- }
- public function getPublished() {
- return $this->published;
- }
- public function setPublishedLink($publishedLink) {
- $this->publishedLink = $publishedLink;
- }
- public function getPublishedLink() {
- return $this->publishedLink;
- }
- public function setPublishedOutsideDomain($publishedOutsideDomain) {
- $this->publishedOutsideDomain = $publishedOutsideDomain;
- }
- public function getPublishedOutsideDomain() {
- return $this->publishedOutsideDomain;
- }
- public function setSelfLink($selfLink) {
- $this->selfLink = $selfLink;
- }
- public function getSelfLink() {
- return $this->selfLink;
- }
-}
-
-class Google_RevisionList extends Google_Model {
- public $etag;
- protected $__itemsType = 'Google_Revision';
- protected $__itemsDataType = 'array';
- public $items;
- public $kind;
- public $selfLink;
- public function setEtag($etag) {
- $this->etag = $etag;
- }
- public function getEtag() {
- return $this->etag;
- }
- public function setItems(/* array(Google_Revision) */ $items) {
- $this->assertIsArray($items, 'Google_Revision', __METHOD__);
- $this->items = $items;
- }
- public function getItems() {
- return $this->items;
- }
- public function setKind($kind) {
- $this->kind = $kind;
- }
- public function getKind() {
- return $this->kind;
- }
- public function setSelfLink($selfLink) {
- $this->selfLink = $selfLink;
- }
- public function getSelfLink() {
- return $this->selfLink;
- }
-}
-
-class Google_User extends Google_Model {
- public $displayName;
- public $isAuthenticatedUser;
- public $kind;
- public $permissionId;
- protected $__pictureType = 'Google_UserPicture';
- protected $__pictureDataType = '';
- public $picture;
- public function setDisplayName($displayName) {
- $this->displayName = $displayName;
- }
- public function getDisplayName() {
- return $this->displayName;
- }
- public function setIsAuthenticatedUser($isAuthenticatedUser) {
- $this->isAuthenticatedUser = $isAuthenticatedUser;
- }
- public function getIsAuthenticatedUser() {
- return $this->isAuthenticatedUser;
- }
- public function setKind($kind) {
- $this->kind = $kind;
- }
- public function getKind() {
- return $this->kind;
- }
- public function setPermissionId($permissionId) {
- $this->permissionId = $permissionId;
- }
- public function getPermissionId() {
- return $this->permissionId;
- }
- public function setPicture(Google_UserPicture $picture) {
- $this->picture = $picture;
- }
- public function getPicture() {
- return $this->picture;
- }
-}
-
-class Google_UserPicture extends Google_Model {
- public $url;
- public function setUrl($url) {
- $this->url = $url;
- }
- public function getUrl() {
- return $this->url;
- }
-}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/external/URITemplateParser.php b/apps/files_external/3rdparty/google-api-php-client/src/external/URITemplateParser.php
deleted file mode 100644
index 594adbb15e2..00000000000
--- a/apps/files_external/3rdparty/google-api-php-client/src/external/URITemplateParser.php
+++ /dev/null
@@ -1,209 +0,0 @@
-<?php
-/*
-Copyright (c) 2010 Kevin M Burns Jr, http://kevburnsjr.com/
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-/**
- * A URI Template Parser which is used by the apiREST class to resolve the REST requests
- * Blogpost: http://lab.kevburnsjr.com/php-uri-template-parser
- * Source: http://github.com/KevBurnsJr/php-uri-template-parser
- */
-class URI_Template_Parser {
-
- public static $operators = array('+', ';', '?', '/', '.');
- public static $reserved_operators = array('|', '!', '@');
- public static $explode_modifiers = array('+', '*');
- public static $partial_modifiers = array(':', '^');
-
- public static $gen_delims = array(':', '/', '?', '#', '[', ']', '@');
- public static $gen_delims_pct = array('%3A', '%2F', '%3F', '%23', '%5B', '%5D', '%40');
- public static $sub_delims = array('!', '$', '&', '\'', '(', ')', '*', '+', ',', ';', '=');
- public static $sub_delims_pct = array('%21', '%24', '%26', '%27', '%28', '%29', '%2A', '%2B', '%2C', '%3B', '%3D');
- public static $reserved;
- public static $reserved_pct;
-
- public function __construct($template) {
- self::$reserved = array_merge(self::$gen_delims, self::$sub_delims);
- self::$reserved_pct = array_merge(self::$gen_delims_pct, self::$sub_delims_pct);
- $this->template = $template;
- }
-
- public function expand($data) {
- // Modification to make this a bit more performant (since gettype is very slow)
- if (! is_array($data)) {
- $data = (array)$data;
- }
- /*
- // Original code, which uses a slow gettype() statement, kept in place for if the assumption that is_array always works here is incorrect
- switch (gettype($data)) {
- case "boolean":
- case "integer":
- case "double":
- case "string":
- case "object":
- $data = (array)$data;
- break;
- }
-*/
-
- // Resolve template vars
- preg_match_all('/\{([^\}]*)\}/', $this->template, $em);
-
- foreach ($em[1] as $i => $bare_expression) {
- preg_match('/^([\+\;\?\/\.]{1})?(.*)$/', $bare_expression, $lm);
- $exp = new StdClass();
- $exp->expression = $em[0][$i];
- $exp->operator = $lm[1];
- $exp->variable_list = $lm[2];
- $exp->varspecs = explode(',', $exp->variable_list);
- $exp->vars = array();
- foreach ($exp->varspecs as $varspec) {
- preg_match('/^([a-zA-Z0-9_]+)([\*\+]{1})?([\:\^][0-9-]+)?(\=[^,]+)?$/', $varspec, $vm);
- $var = new StdClass();
- $var->name = $vm[1];
- $var->modifier = isset($vm[2]) && $vm[2] ? $vm[2] : null;
- $var->modifier = isset($vm[3]) && $vm[3] ? $vm[3] : $var->modifier;
- $var->default = isset($vm[4]) ? substr($vm[4], 1) : null;
- $exp->vars[] = $var;
- }
-
- // Add processing flags
- $exp->reserved = false;
- $exp->prefix = '';
- $exp->delimiter = ',';
- switch ($exp->operator) {
- case '+':
- $exp->reserved = 'true';
- break;
- case ';':
- $exp->prefix = ';';
- $exp->delimiter = ';';
- break;
- case '?':
- $exp->prefix = '?';
- $exp->delimiter = '&';
- break;
- case '/':
- $exp->prefix = '/';
- $exp->delimiter = '/';
- break;
- case '.':
- $exp->prefix = '.';
- $exp->delimiter = '.';
- break;
- }
- $expressions[] = $exp;
- }
-
- // Expansion
- $this->expansion = $this->template;
-
- foreach ($expressions as $exp) {
- $part = $exp->prefix;
- $exp->one_var_defined = false;
- foreach ($exp->vars as $var) {
- $val = '';
- if ($exp->one_var_defined && isset($data[$var->name])) {
- $part .= $exp->delimiter;
- }
- // Variable present
- if (isset($data[$var->name])) {
- $exp->one_var_defined = true;
- $var->data = $data[$var->name];
-
- $val = self::val_from_var($var, $exp);
-
- // Variable missing
- } else {
- if ($var->default) {
- $exp->one_var_defined = true;
- $val = $var->default;
- }
- }
- $part .= $val;
- }
- if (! $exp->one_var_defined) $part = '';
- $this->expansion = str_replace($exp->expression, $part, $this->expansion);
- }
-
- return $this->expansion;
- }
-
- private function val_from_var($var, $exp) {
- $val = '';
- if (is_array($var->data)) {
- $i = 0;
- if ($exp->operator == '?' && ! $var->modifier) {
- $val .= $var->name . '=';
- }
- foreach ($var->data as $k => $v) {
- $del = $var->modifier ? $exp->delimiter : ',';
- $ek = rawurlencode($k);
- $ev = rawurlencode($v);
-
- // Array
- if ($k !== $i) {
- if ($var->modifier == '+') {
- $val .= $var->name . '.';
- }
- if ($exp->operator == '?' && $var->modifier || $exp->operator == ';' && $var->modifier == '*' || $exp->operator == ';' && $var->modifier == '+') {
- $val .= $ek . '=';
- } else {
- $val .= $ek . $del;
- }
-
- // List
- } else {
- if ($var->modifier == '+') {
- if ($exp->operator == ';' && $var->modifier == '*' || $exp->operator == ';' && $var->modifier == '+' || $exp->operator == '?' && $var->modifier == '+') {
- $val .= $var->name . '=';
- } else {
- $val .= $var->name . '.';
- }
- }
- }
- $val .= $ev . $del;
- $i ++;
- }
- $val = trim($val, $del);
-
- // Strings, numbers, etc.
- } else {
- if ($exp->operator == '?') {
- $val = $var->name . (isset($var->data) ? '=' : '');
- } else if ($exp->operator == ';') {
- $val = $var->name . ($var->data ? '=' : '');
- }
- $val .= rawurlencode($var->data);
- if ($exp->operator == '+') {
- $val = str_replace(self::$reserved_pct, self::$reserved, $val);
- }
- }
- return $val;
- }
-
- public function match($uri) {}
-
- public function __toString() {
- return $this->template;
- }
-}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/io/Google_CurlIO.php b/apps/files_external/3rdparty/google-api-php-client/src/io/Google_CurlIO.php
deleted file mode 100644
index 65352f29882..00000000000
--- a/apps/files_external/3rdparty/google-api-php-client/src/io/Google_CurlIO.php
+++ /dev/null
@@ -1,278 +0,0 @@
-<?php
-/*
- * Copyright 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Curl based implementation of apiIO.
- *
- * @author Chris Chabot <chabotc@google.com>
- * @author Chirag Shah <chirags@google.com>
- */
-
-require_once 'Google_CacheParser.php';
-
-class Google_CurlIO implements Google_IO {
- const CONNECTION_ESTABLISHED = "HTTP/1.0 200 Connection established\r\n\r\n";
- const FORM_URLENCODED = 'application/x-www-form-urlencoded';
-
- private static $ENTITY_HTTP_METHODS = array("POST" => null, "PUT" => null);
- private static $HOP_BY_HOP = array(
- 'connection', 'keep-alive', 'proxy-authenticate', 'proxy-authorization',
- 'te', 'trailers', 'transfer-encoding', 'upgrade');
-
- private $curlParams = array (
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_FOLLOWLOCATION => 0,
- CURLOPT_FAILONERROR => false,
- CURLOPT_SSL_VERIFYPEER => true,
- CURLOPT_HEADER => true,
- CURLOPT_VERBOSE => false,
- );
-
- /**
- * Perform an authenticated / signed apiHttpRequest.
- * This function takes the apiHttpRequest, calls apiAuth->sign on it
- * (which can modify the request in what ever way fits the auth mechanism)
- * and then calls apiCurlIO::makeRequest on the signed request
- *
- * @param Google_HttpRequest $request
- * @return Google_HttpRequest The resulting HTTP response including the
- * responseHttpCode, responseHeaders and responseBody.
- */
- public function authenticatedRequest(Google_HttpRequest $request) {
- $request = Google_Client::$auth->sign($request);
- return $this->makeRequest($request);
- }
-
- /**
- * Execute a apiHttpRequest
- *
- * @param Google_HttpRequest $request the http request to be executed
- * @return Google_HttpRequest http request with the response http code, response
- * headers and response body filled in
- * @throws Google_IOException on curl or IO error
- */
- public function makeRequest(Google_HttpRequest $request) {
- // First, check to see if we have a valid cached version.
- $cached = $this->getCachedRequest($request);
- if ($cached !== false) {
- if (Google_CacheParser::mustRevalidate($cached)) {
- $addHeaders = array();
- if ($cached->getResponseHeader('etag')) {
- // [13.3.4] If an entity tag has been provided by the origin server,
- // we must use that entity tag in any cache-conditional request.
- $addHeaders['If-None-Match'] = $cached->getResponseHeader('etag');
- } elseif ($cached->getResponseHeader('date')) {
- $addHeaders['If-Modified-Since'] = $cached->getResponseHeader('date');
- }
-
- $request->setRequestHeaders($addHeaders);
- } else {
- // No need to revalidate the request, return it directly
- return $cached;
- }
- }
-
- if (array_key_exists($request->getRequestMethod(),
- self::$ENTITY_HTTP_METHODS)) {
- $request = $this->processEntityRequest($request);
- }
-
- $ch = curl_init();
- curl_setopt_array($ch, $this->curlParams);
- curl_setopt($ch, CURLOPT_URL, $request->getUrl());
- if ($request->getPostBody()) {
- curl_setopt($ch, CURLOPT_POSTFIELDS, $request->getPostBody());
- }
-
- $requestHeaders = $request->getRequestHeaders();
- if ($requestHeaders && is_array($requestHeaders)) {
- $parsed = array();
- foreach ($requestHeaders as $k => $v) {
- $parsed[] = "$k: $v";
- }
- curl_setopt($ch, CURLOPT_HTTPHEADER, $parsed);
- }
-
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $request->getRequestMethod());
- curl_setopt($ch, CURLOPT_USERAGENT, $request->getUserAgent());
- $respData = curl_exec($ch);
-
- // Retry if certificates are missing.
- if (curl_errno($ch) == CURLE_SSL_CACERT) {
- error_log('SSL certificate problem, verify that the CA cert is OK.'
- . ' Retrying with the CA cert bundle from google-api-php-client.');
- curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__) . '/cacerts.pem');
- $respData = curl_exec($ch);
- }
-
- $respHeaderSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
- $respHttpCode = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE);
- $curlErrorNum = curl_errno($ch);
- $curlError = curl_error($ch);
- curl_close($ch);
- if ($curlErrorNum != CURLE_OK) {
- throw new Google_IOException("HTTP Error: ($respHttpCode) $curlError");
- }
-
- // Parse out the raw response into usable bits
- list($responseHeaders, $responseBody) =
- self::parseHttpResponse($respData, $respHeaderSize);
-
- if ($respHttpCode == 304 && $cached) {
- // If the server responded NOT_MODIFIED, return the cached request.
- if (isset($responseHeaders['connection'])) {
- $hopByHop = array_merge(
- self::$HOP_BY_HOP,
- explode(',', $responseHeaders['connection'])
- );
-
- $endToEnd = array();
- foreach($hopByHop as $key) {
- if (isset($responseHeaders[$key])) {
- $endToEnd[$key] = $responseHeaders[$key];
- }
- }
- $cached->setResponseHeaders($endToEnd);
- }
- return $cached;
- }
-
- // Fill in the apiHttpRequest with the response values
- $request->setResponseHttpCode($respHttpCode);
- $request->setResponseHeaders($responseHeaders);
- $request->setResponseBody($responseBody);
- // Store the request in cache (the function checks to see if the request
- // can actually be cached)
- $this->setCachedRequest($request);
- // And finally return it
- return $request;
- }
-
- /**
- * @visible for testing.
- * Cache the response to an HTTP request if it is cacheable.
- * @param Google_HttpRequest $request
- * @return bool Returns true if the insertion was successful.
- * Otherwise, return false.
- */
- public function setCachedRequest(Google_HttpRequest $request) {
- // Determine if the request is cacheable.
- if (Google_CacheParser::isResponseCacheable($request)) {
- Google_Client::$cache->set($request->getCacheKey(), $request);
- return true;
- }
-
- return false;
- }
-
- /**
- * @visible for testing.
- * @param Google_HttpRequest $request
- * @return Google_HttpRequest|bool Returns the cached object or
- * false if the operation was unsuccessful.
- */
- public function getCachedRequest(Google_HttpRequest $request) {
- if (false == Google_CacheParser::isRequestCacheable($request)) {
- false;
- }
-
- return Google_Client::$cache->get($request->getCacheKey());
- }
-
- /**
- * @param $respData
- * @param $headerSize
- * @return array
- */
- public static function parseHttpResponse($respData, $headerSize) {
- if (stripos($respData, self::CONNECTION_ESTABLISHED) !== false) {
- $respData = str_ireplace(self::CONNECTION_ESTABLISHED, '', $respData);
- }
-
- if ($headerSize) {
- $responseBody = substr($respData, $headerSize);
- $responseHeaders = substr($respData, 0, $headerSize);
- } else {
- list($responseHeaders, $responseBody) = explode("\r\n\r\n", $respData, 2);
- }
-
- $responseHeaders = self::parseResponseHeaders($responseHeaders);
- return array($responseHeaders, $responseBody);
- }
-
- public static function parseResponseHeaders($rawHeaders) {
- $responseHeaders = array();
-
- $responseHeaderLines = explode("\r\n", $rawHeaders);
- foreach ($responseHeaderLines as $headerLine) {
- if ($headerLine && strpos($headerLine, ':') !== false) {
- list($header, $value) = explode(': ', $headerLine, 2);
- $header = strtolower($header);
- if (isset($responseHeaders[$header])) {
- $responseHeaders[$header] .= "\n" . $value;
- } else {
- $responseHeaders[$header] = $value;
- }
- }
- }
- return $responseHeaders;
- }
-
- /**
- * @visible for testing
- * Process an http request that contains an enclosed entity.
- * @param Google_HttpRequest $request
- * @return Google_HttpRequest Processed request with the enclosed entity.
- */
- public function processEntityRequest(Google_HttpRequest $request) {
- $postBody = $request->getPostBody();
- $contentType = $request->getRequestHeader("content-type");
-
- // Set the default content-type as application/x-www-form-urlencoded.
- if (false == $contentType) {
- $contentType = self::FORM_URLENCODED;
- $request->setRequestHeaders(array('content-type' => $contentType));
- }
-
- // Force the payload to match the content-type asserted in the header.
- if ($contentType == self::FORM_URLENCODED && is_array($postBody)) {
- $postBody = http_build_query($postBody, '', '&');
- $request->setPostBody($postBody);
- }
-
- // Make sure the content-length header is set.
- if (!$postBody || is_string($postBody)) {
- $postsLength = strlen($postBody);
- $request->setRequestHeaders(array('content-length' => $postsLength));
- }
-
- return $request;
- }
-
- /**
- * Set options that update cURL's default behavior.
- * The list of accepted options are:
- * {@link http://php.net/manual/en/function.curl-setopt.php]
- *
- * @param array $optCurlParams Multiple options used by a cURL session.
- */
- public function setOptions($optCurlParams) {
- foreach ($optCurlParams as $key => $val) {
- $this->curlParams[$key] = $val;
- }
- }
-} \ No newline at end of file
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/io/Google_HttpRequest.php b/apps/files_external/3rdparty/google-api-php-client/src/io/Google_HttpRequest.php
deleted file mode 100644
index b98eae54008..00000000000
--- a/apps/files_external/3rdparty/google-api-php-client/src/io/Google_HttpRequest.php
+++ /dev/null
@@ -1,304 +0,0 @@
-<?php
-/*
- * Copyright 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * HTTP Request to be executed by apiIO classes. Upon execution, the
- * responseHttpCode, responseHeaders and responseBody will be filled in.
- *
- * @author Chris Chabot <chabotc@google.com>
- * @author Chirag Shah <chirags@google.com>
- *
- */
-class Google_HttpRequest {
- const USER_AGENT_SUFFIX = "google-api-php-client/0.6.0";
- private $batchHeaders = array(
- 'Content-Type' => 'application/http',
- 'Content-Transfer-Encoding' => 'binary',
- 'MIME-Version' => '1.0',
- 'Content-Length' => ''
- );
-
- protected $url;
- protected $requestMethod;
- protected $requestHeaders;
- protected $postBody;
- protected $userAgent;
-
- protected $responseHttpCode;
- protected $responseHeaders;
- protected $responseBody;
-
- public $accessKey;
-
- public function __construct($url, $method = 'GET', $headers = array(), $postBody = null) {
- $this->setUrl($url);
- $this->setRequestMethod($method);
- $this->setRequestHeaders($headers);
- $this->setPostBody($postBody);
-
- global $apiConfig;
- if (empty($apiConfig['application_name'])) {
- $this->userAgent = self::USER_AGENT_SUFFIX;
- } else {
- $this->userAgent = $apiConfig['application_name'] . " " . self::USER_AGENT_SUFFIX;
- }
- }
-
- /**
- * Misc function that returns the base url component of the $url
- * used by the OAuth signing class to calculate the base string
- * @return string The base url component of the $url.
- * @see http://oauth.net/core/1.0a/#anchor13
- */
- public function getBaseUrl() {
- if ($pos = strpos($this->url, '?')) {
- return substr($this->url, 0, $pos);
- }
- return $this->url;
- }
-
- /**
- * Misc function that returns an array of the query parameters of the current
- * url used by the OAuth signing class to calculate the signature
- * @return array Query parameters in the query string.
- */
- public function getQueryParams() {
- if ($pos = strpos($this->url, '?')) {
- $queryStr = substr($this->url, $pos + 1);
- $params = array();
- parse_str($queryStr, $params);
- return $params;
- }
- return array();
- }
-
- /**
- * @return string HTTP Response Code.
- */
- public function getResponseHttpCode() {
- return (int) $this->responseHttpCode;
- }
-
- /**
- * @param int $responseHttpCode HTTP Response Code.
- */
- public function setResponseHttpCode($responseHttpCode) {
- $this->responseHttpCode = $responseHttpCode;
- }
-
- /**
- * @return $responseHeaders (array) HTTP Response Headers.
- */
- public function getResponseHeaders() {
- return $this->responseHeaders;
- }
-
- /**
- * @return string HTTP Response Body
- */
- public function getResponseBody() {
- return $this->responseBody;
- }
-
- /**
- * @param array $headers The HTTP response headers
- * to be normalized.
- */
- public function setResponseHeaders($headers) {
- $headers = Google_Utils::normalize($headers);
- if ($this->responseHeaders) {
- $headers = array_merge($this->responseHeaders, $headers);
- }
-
- $this->responseHeaders = $headers;
- }
-
- /**
- * @param string $key
- * @return array|boolean Returns the requested HTTP header or
- * false if unavailable.
- */
- public function getResponseHeader($key) {
- return isset($this->responseHeaders[$key])
- ? $this->responseHeaders[$key]
- : false;
- }
-
- /**
- * @param string $responseBody The HTTP response body.
- */
- public function setResponseBody($responseBody) {
- $this->responseBody = $responseBody;
- }
-
- /**
- * @return string $url The request URL.
- */
-
- public function getUrl() {
- return $this->url;
- }
-
- /**
- * @return string $method HTTP Request Method.
- */
- public function getRequestMethod() {
- return $this->requestMethod;
- }
-
- /**
- * @return array $headers HTTP Request Headers.
- */
- public function getRequestHeaders() {
- return $this->requestHeaders;
- }
-
- /**
- * @param string $key
- * @return array|boolean Returns the requested HTTP header or
- * false if unavailable.
- */
- public function getRequestHeader($key) {
- return isset($this->requestHeaders[$key])
- ? $this->requestHeaders[$key]
- : false;
- }
-
- /**
- * @return string $postBody HTTP Request Body.
- */
- public function getPostBody() {
- return $this->postBody;
- }
-
- /**
- * @param string $url the url to set
- */
- public function setUrl($url) {
- if (substr($url, 0, 4) == 'http') {
- $this->url = $url;
- } else {
- // Force the path become relative.
- if (substr($url, 0, 1) !== '/') {
- $url = '/' . $url;
- }
- global $apiConfig;
- $this->url = $apiConfig['basePath'] . $url;
- }
- }
-
- /**
- * @param string $method Set he HTTP Method and normalize
- * it to upper-case, as required by HTTP.
- *
- */
- public function setRequestMethod($method) {
- $this->requestMethod = strtoupper($method);
- }
-
- /**
- * @param array $headers The HTTP request headers
- * to be set and normalized.
- */
- public function setRequestHeaders($headers) {
- $headers = Google_Utils::normalize($headers);
- if ($this->requestHeaders) {
- $headers = array_merge($this->requestHeaders, $headers);
- }
- $this->requestHeaders = $headers;
- }
-
- /**
- * @param string $postBody the postBody to set
- */
- public function setPostBody($postBody) {
- $this->postBody = $postBody;
- }
-
- /**
- * Set the User-Agent Header.
- * @param string $userAgent The User-Agent.
- */
- public function setUserAgent($userAgent) {
- $this->userAgent = $userAgent;
- }
-
- /**
- * @return string The User-Agent.
- */
- public function getUserAgent() {
- return $this->userAgent;
- }
-
- /**
- * Returns a cache key depending on if this was an OAuth signed request
- * in which case it will use the non-signed url and access key to make this
- * cache key unique per authenticated user, else use the plain request url
- * @return string The md5 hash of the request cache key.
- */
- public function getCacheKey() {
- $key = $this->getUrl();
-
- if (isset($this->accessKey)) {
- $key .= $this->accessKey;
- }
-
- if (isset($this->requestHeaders['authorization'])) {
- $key .= $this->requestHeaders['authorization'];
- }
-
- return md5($key);
- }
-
- public function getParsedCacheControl() {
- $parsed = array();
- $rawCacheControl = $this->getResponseHeader('cache-control');
- if ($rawCacheControl) {
- $rawCacheControl = str_replace(', ', '&', $rawCacheControl);
- parse_str($rawCacheControl, $parsed);
- }
-
- return $parsed;
- }
-
- /**
- * @param string $id
- * @return string A string representation of the HTTP Request.
- */
- public function toBatchString($id) {
- $str = '';
- foreach($this->batchHeaders as $key => $val) {
- $str .= $key . ': ' . $val . "\n";
- }
-
- $str .= "Content-ID: $id\n";
- $str .= "\n";
-
- $path = parse_url($this->getUrl(), PHP_URL_PATH);
- $str .= $this->getRequestMethod() . ' ' . $path . " HTTP/1.1\n";
- foreach($this->getRequestHeaders() as $key => $val) {
- $str .= $key . ': ' . $val . "\n";
- }
-
- if ($this->getPostBody()) {
- $str .= "\n";
- $str .= $this->getPostBody();
- }
-
- return $str;
- }
-}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/io/Google_IO.php b/apps/files_external/3rdparty/google-api-php-client/src/io/Google_IO.php
deleted file mode 100644
index 5445e699038..00000000000
--- a/apps/files_external/3rdparty/google-api-php-client/src/io/Google_IO.php
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-/**
- * Copyright 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-require_once 'io/Google_HttpRequest.php';
-require_once 'io/Google_CurlIO.php';
-require_once 'io/Google_REST.php';
-
-/**
- * Abstract IO class
- *
- * @author Chris Chabot <chabotc@google.com>
- */
-interface Google_IO {
- /**
- * An utility function that first calls $this->auth->sign($request) and then executes makeRequest()
- * on that signed request. Used for when a request should be authenticated
- * @param Google_HttpRequest $request
- * @return Google_HttpRequest $request
- */
- public function authenticatedRequest(Google_HttpRequest $request);
-
- /**
- * Executes a apIHttpRequest and returns the resulting populated httpRequest
- * @param Google_HttpRequest $request
- * @return Google_HttpRequest $request
- */
- public function makeRequest(Google_HttpRequest $request);
-
- /**
- * Set options that update the transport implementation's behavior.
- * @param $options
- */
- public function setOptions($options);
-
-}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/service/Google_MediaFileUpload.php b/apps/files_external/3rdparty/google-api-php-client/src/service/Google_MediaFileUpload.php
deleted file mode 100644
index c64e18851df..00000000000
--- a/apps/files_external/3rdparty/google-api-php-client/src/service/Google_MediaFileUpload.php
+++ /dev/null
@@ -1,262 +0,0 @@
-<?php
-/**
- * Copyright 2012 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @author Chirag Shah <chirags@google.com>
- *
- */
-class Google_MediaFileUpload {
- const UPLOAD_MEDIA_TYPE = 'media';
- const UPLOAD_MULTIPART_TYPE = 'multipart';
- const UPLOAD_RESUMABLE_TYPE = 'resumable';
-
- /** @var string $mimeType */
- public $mimeType;
-
- /** @var string $data */
- public $data;
-
- /** @var bool $resumable */
- public $resumable;
-
- /** @var int $chunkSize */
- public $chunkSize;
-
- /** @var int $size */
- public $size;
-
- /** @var string $resumeUri */
- public $resumeUri;
-
- /** @var int $progress */
- public $progress;
-
- /**
- * @param $mimeType string
- * @param $data string The bytes you want to upload.
- * @param $resumable bool
- * @param bool $chunkSize File will be uploaded in chunks of this many bytes.
- * only used if resumable=True
- */
- public function __construct($mimeType, $data, $resumable=false, $chunkSize=false) {
- $this->mimeType = $mimeType;
- $this->data = $data;
- $this->size = strlen($this->data);
- $this->resumable = $resumable;
- if(!$chunkSize) {
- $chunkSize = 256 * 1024;
- }
- $this->chunkSize = $chunkSize;
- $this->progress = 0;
- }
-
- public function setFileSize($size) {
- $this->size = $size;
- }
-
- /**
- * @static
- * @param $meta
- * @param $params
- * @return array|bool
- */
- public static function process($meta, &$params) {
- $payload = array();
- $meta = is_string($meta) ? json_decode($meta, true) : $meta;
- $uploadType = self::getUploadType($meta, $payload, $params);
- if (!$uploadType) {
- // Process as a normal API request.
- return false;
- }
-
- // Process as a media upload request.
- $params['uploadType'] = array(
- 'type' => 'string',
- 'location' => 'query',
- 'value' => $uploadType,
- );
-
- $mimeType = isset($params['mimeType'])
- ? $params['mimeType']['value']
- : false;
- unset($params['mimeType']);
-
- if (!$mimeType) {
- $mimeType = $payload['content-type'];
- }
-
- if (isset($params['file'])) {
- // This is a standard file upload with curl.
- $file = $params['file']['value'];
- unset($params['file']);
- return self::processFileUpload($file, $mimeType);
- }
-
- $data = isset($params['data'])
- ? $params['data']['value']
- : false;
- unset($params['data']);
-
- if (self::UPLOAD_RESUMABLE_TYPE == $uploadType) {
- $payload['content-type'] = $mimeType;
- $payload['postBody'] = is_string($meta) ? $meta : json_encode($meta);
-
- } elseif (self::UPLOAD_MEDIA_TYPE == $uploadType) {
- // This is a simple media upload.
- $payload['content-type'] = $mimeType;
- $payload['postBody'] = $data;
- }
-
- elseif (self::UPLOAD_MULTIPART_TYPE == $uploadType) {
- // This is a multipart/related upload.
- $boundary = isset($params['boundary']['value']) ? $params['boundary']['value'] : mt_rand();
- $boundary = str_replace('"', '', $boundary);
- $payload['content-type'] = 'multipart/related; boundary=' . $boundary;
- $related = "--$boundary\r\n";
- $related .= "Content-Type: application/json; charset=UTF-8\r\n";
- $related .= "\r\n" . json_encode($meta) . "\r\n";
- $related .= "--$boundary\r\n";
- $related .= "Content-Type: $mimeType\r\n";
- $related .= "Content-Transfer-Encoding: base64\r\n";
- $related .= "\r\n" . base64_encode($data) . "\r\n";
- $related .= "--$boundary--";
- $payload['postBody'] = $related;
- }
-
- return $payload;
- }
-
- /**
- * Prepares a standard file upload via cURL.
- * @param $file
- * @param $mime
- * @return array Includes the processed file name.
- * @visible For testing.
- */
- public static function processFileUpload($file, $mime) {
- if (!$file) return array();
- if (substr($file, 0, 1) != '@') {
- $file = '@' . $file;
- }
-
- // This is a standard file upload with curl.
- $params = array('postBody' => array('file' => $file));
- if ($mime) {
- $params['content-type'] = $mime;
- }
-
- return $params;
- }
-
- /**
- * Valid upload types:
- * - resumable (UPLOAD_RESUMABLE_TYPE)
- * - media (UPLOAD_MEDIA_TYPE)
- * - multipart (UPLOAD_MULTIPART_TYPE)
- * - none (false)
- * @param $meta
- * @param $payload
- * @param $params
- * @return bool|string
- */
- public static function getUploadType($meta, &$payload, &$params) {
- if (isset($params['mediaUpload'])
- && get_class($params['mediaUpload']['value']) == 'Google_MediaFileUpload') {
- $upload = $params['mediaUpload']['value'];
- unset($params['mediaUpload']);
- $payload['content-type'] = $upload->mimeType;
- if (isset($upload->resumable) && $upload->resumable) {
- return self::UPLOAD_RESUMABLE_TYPE;
- }
- }
-
- // Allow the developer to override the upload type.
- if (isset($params['uploadType'])) {
- return $params['uploadType']['value'];
- }
-
- $data = isset($params['data']['value'])
- ? $params['data']['value'] : false;
-
- if (false == $data && false == isset($params['file'])) {
- // No upload data available.
- return false;
- }
-
- if (isset($params['file'])) {
- return self::UPLOAD_MEDIA_TYPE;
- }
-
- if (false == $meta) {
- return self::UPLOAD_MEDIA_TYPE;
- }
-
- return self::UPLOAD_MULTIPART_TYPE;
- }
-
-
- public function nextChunk(Google_HttpRequest $req, $chunk=false) {
- if (false == $this->resumeUri) {
- $this->resumeUri = $this->getResumeUri($req);
- }
-
- if (false == $chunk) {
- $chunk = substr($this->data, $this->progress, $this->chunkSize);
- }
-
- $lastBytePos = $this->progress + strlen($chunk) - 1;
- $headers = array(
- 'content-range' => "bytes $this->progress-$lastBytePos/$this->size",
- 'content-type' => $req->getRequestHeader('content-type'),
- 'content-length' => $this->chunkSize,
- 'expect' => '',
- );
-
- $httpRequest = new Google_HttpRequest($this->resumeUri, 'PUT', $headers, $chunk);
- $response = Google_Client::$io->authenticatedRequest($httpRequest);
- $code = $response->getResponseHttpCode();
- if (308 == $code) {
- $range = explode('-', $response->getResponseHeader('range'));
- $this->progress = $range[1] + 1;
- return false;
- } else {
- return Google_REST::decodeHttpResponse($response);
- }
- }
-
- private function getResumeUri(Google_HttpRequest $httpRequest) {
- $result = null;
- $body = $httpRequest->getPostBody();
- if ($body) {
- $httpRequest->setRequestHeaders(array(
- 'content-type' => 'application/json; charset=UTF-8',
- 'content-length' => Google_Utils::getStrLen($body),
- 'x-upload-content-type' => $this->mimeType,
- 'x-upload-content-length' => $this->size,
- 'expect' => '',
- ));
- }
-
- $response = Google_Client::$io->makeRequest($httpRequest);
- $location = $response->getResponseHeader('location');
- $code = $response->getResponseHttpCode();
- if (200 == $code && true == $location) {
- return $location;
- }
- throw new Google_Exception("Failed to start the resumable upload");
- }
-} \ No newline at end of file
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/service/Google_Model.php b/apps/files_external/3rdparty/google-api-php-client/src/service/Google_Model.php
deleted file mode 100644
index cb44cb25748..00000000000
--- a/apps/files_external/3rdparty/google-api-php-client/src/service/Google_Model.php
+++ /dev/null
@@ -1,115 +0,0 @@
-<?php
-/*
- * Copyright 2011 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * This class defines attributes, valid values, and usage which is generated from
- * a given json schema. http://tools.ietf.org/html/draft-zyp-json-schema-03#section-5
- *
- * @author Chirag Shah <chirags@google.com>
- *
- */
-class Google_Model {
- public function __construct( /* polymorphic */ ) {
- if (func_num_args() == 1 && is_array(func_get_arg(0))) {
- // Initialize the model with the array's contents.
- $array = func_get_arg(0);
- $this->mapTypes($array);
- }
- }
-
- /**
- * Initialize this object's properties from an array.
- *
- * @param array $array Used to seed this object's properties.
- * @return void
- */
- protected function mapTypes($array) {
- foreach ($array as $key => $val) {
- $this->$key = $val;
-
- $keyTypeName = "__$key" . 'Type';
- $keyDataType = "__$key" . 'DataType';
- if ($this->useObjects() && property_exists($this, $keyTypeName)) {
- if ($this->isAssociativeArray($val)) {
- if (isset($this->$keyDataType) && 'map' == $this->$keyDataType) {
- foreach($val as $arrayKey => $arrayItem) {
- $val[$arrayKey] = $this->createObjectFromName($keyTypeName, $arrayItem);
- }
- $this->$key = $val;
- } else {
- $this->$key = $this->createObjectFromName($keyTypeName, $val);
- }
- } else if (is_array($val)) {
- $arrayObject = array();
- foreach ($val as $arrayIndex => $arrayItem) {
- $arrayObject[$arrayIndex] = $this->createObjectFromName($keyTypeName, $arrayItem);
- }
- $this->$key = $arrayObject;
- }
- }
- }
- }
-
- /**
- * Returns true only if the array is associative.
- * @param array $array
- * @return bool True if the array is associative.
- */
- protected function isAssociativeArray($array) {
- if (!is_array($array)) {
- return false;
- }
- $keys = array_keys($array);
- foreach($keys as $key) {
- if (is_string($key)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Given a variable name, discover its type.
- *
- * @param $name
- * @param $item
- * @return object The object from the item.
- */
- private function createObjectFromName($name, $item) {
- $type = $this->$name;
- return new $type($item);
- }
-
- protected function useObjects() {
- global $apiConfig;
- return (isset($apiConfig['use_objects']) && $apiConfig['use_objects']);
- }
-
- /**
- * Verify if $obj is an array.
- * @throws Google_Exception Thrown if $obj isn't an array.
- * @param array $obj Items that should be validated.
- * @param string $type Array items should be of this type.
- * @param string $method Method expecting an array as an argument.
- */
- public function assertIsArray($obj, $type, $method) {
- if ($obj && !is_array($obj)) {
- throw new Google_Exception("Incorrect parameter type passed to $method(), expected an"
- . " array containing items of type $type.");
- }
- }
-}
diff --git a/apps/files_external/3rdparty/google-api-php-client/src/service/Google_ServiceResource.php b/apps/files_external/3rdparty/google-api-php-client/src/service/Google_ServiceResource.php
deleted file mode 100644
index bb3af4db809..00000000000
--- a/apps/files_external/3rdparty/google-api-php-client/src/service/Google_ServiceResource.php
+++ /dev/null
@@ -1,205 +0,0 @@
-<?php
-/**
- * Copyright 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Implements the actual methods/resources of the discovered Google API using magic function
- * calling overloading (__call()), which on call will see if the method name (plus.activities.list)
- * is available in this service, and if so construct an apiHttpRequest representing it.
- *
- * @author Chris Chabot <chabotc@google.com>
- * @author Chirag Shah <chirags@google.com>
- *
- */
-class Google_ServiceResource {
- // Valid query parameters that work, but don't appear in discovery.
- private $stackParameters = array(
- 'alt' => array('type' => 'string', 'location' => 'query'),
- 'boundary' => array('type' => 'string', 'location' => 'query'),
- 'fields' => array('type' => 'string', 'location' => 'query'),
- 'trace' => array('type' => 'string', 'location' => 'query'),
- 'userIp' => array('type' => 'string', 'location' => 'query'),
- 'userip' => array('type' => 'string', 'location' => 'query'),
- 'quotaUser' => array('type' => 'string', 'location' => 'query'),
- 'file' => array('type' => 'complex', 'location' => 'body'),
- 'data' => array('type' => 'string', 'location' => 'body'),
- 'mimeType' => array('type' => 'string', 'location' => 'header'),
- 'uploadType' => array('type' => 'string', 'location' => 'query'),
- 'mediaUpload' => array('type' => 'complex', 'location' => 'query'),
- );
-
- /** @var Google_Service $service */
- private $service;
-
- /** @var string $serviceName */
- private $serviceName;
-
- /** @var string $resourceName */
- private $resourceName;
-
- /** @var array $methods */
- private $methods;
-
- public function __construct($service, $serviceName, $resourceName, $resource) {
- $this->service = $service;
- $this->serviceName = $serviceName;
- $this->resourceName = $resourceName;
- $this->methods = isset($resource['methods']) ? $resource['methods'] : array($resourceName => $resource);
- }
-
- /**
- * @param $name
- * @param $arguments
- * @return Google_HttpRequest|array
- * @throws Google_Exception
- */
- public function __call($name, $arguments) {
- if (! isset($this->methods[$name])) {
- throw new Google_Exception("Unknown function: {$this->serviceName}->{$this->resourceName}->{$name}()");
- }
- $method = $this->methods[$name];
- $parameters = $arguments[0];
-
- // postBody is a special case since it's not defined in the discovery document as parameter, but we abuse the param entry for storing it
- $postBody = null;
- if (isset($parameters['postBody'])) {
- if (is_object($parameters['postBody'])) {
- $this->stripNull($parameters['postBody']);
- }
-
- // Some APIs require the postBody to be set under the data key.
- if (is_array($parameters['postBody']) && 'latitude' == $this->serviceName) {
- if (!isset($parameters['postBody']['data'])) {
- $rawBody = $parameters['postBody'];
- unset($parameters['postBody']);
- $parameters['postBody']['data'] = $rawBody;
- }
- }
-
- $postBody = is_array($parameters['postBody']) || is_object($parameters['postBody'])
- ? json_encode($parameters['postBody'])
- : $parameters['postBody'];
- unset($parameters['postBody']);
-
- if (isset($parameters['optParams'])) {
- $optParams = $parameters['optParams'];
- unset($parameters['optParams']);
- $parameters = array_merge($parameters, $optParams);
- }
- }
-
- if (!isset($method['parameters'])) {
- $method['parameters'] = array();
- }
-
- $method['parameters'] = array_merge($method['parameters'], $this->stackParameters);
- foreach ($parameters as $key => $val) {
- if ($key != 'postBody' && ! isset($method['parameters'][$key])) {
- throw new Google_Exception("($name) unknown parameter: '$key'");
- }
- }
- if (isset($method['parameters'])) {
- foreach ($method['parameters'] as $paramName => $paramSpec) {
- if (isset($paramSpec['required']) && $paramSpec['required'] && ! isset($parameters[$paramName])) {
- throw new Google_Exception("($name) missing required param: '$paramName'");
- }
- if (isset($parameters[$paramName])) {
- $value = $parameters[$paramName];
- $parameters[$paramName] = $paramSpec;
- $parameters[$paramName]['value'] = $value;
- unset($parameters[$paramName]['required']);
- } else {
- unset($parameters[$paramName]);
- }
- }
- }
-
- // Discovery v1.0 puts the canonical method id under the 'id' field.
- if (! isset($method['id'])) {
- $method['id'] = $method['rpcMethod'];
- }
-
- // Discovery v1.0 puts the canonical path under the 'path' field.
- if (! isset($method['path'])) {
- $method['path'] = $method['restPath'];
- }
-
- $servicePath = $this->service->servicePath;
-
- // Process Media Request
- $contentType = false;
- if (isset($method['mediaUpload'])) {
- $media = Google_MediaFileUpload::process($postBody, $parameters);
- if ($media) {
- $contentType = isset($media['content-type']) ? $media['content-type']: null;
- $postBody = isset($media['postBody']) ? $media['postBody'] : null;
- $servicePath = $method['mediaUpload']['protocols']['simple']['path'];
- $method['path'] = '';
- }
- }
-
- $url = Google_REST::createRequestUri($servicePath, $method['path'], $parameters);
- $httpRequest = new Google_HttpRequest($url, $method['httpMethod'], null, $postBody);
- if ($postBody) {
- $contentTypeHeader = array();
- if (isset($contentType) && $contentType) {
- $contentTypeHeader['content-type'] = $contentType;
- } else {
- $contentTypeHeader['content-type'] = 'application/json; charset=UTF-8';
- $contentTypeHeader['content-length'] = Google_Utils::getStrLen($postBody);
- }
- $httpRequest->setRequestHeaders($contentTypeHeader);
- }
-
- $httpRequest = Google_Client::$auth->sign($httpRequest);
- if (Google_Client::$useBatch) {
- return $httpRequest;
- }
-
- // Terminate immediately if this is a resumable request.
- if (isset($parameters['uploadType']['value'])
- && Google_MediaFileUpload::UPLOAD_RESUMABLE_TYPE == $parameters['uploadType']['value']) {
- $contentTypeHeader = array();
- if (isset($contentType) && $contentType) {
- $contentTypeHeader['content-type'] = $contentType;
- }
- $httpRequest->setRequestHeaders($contentTypeHeader);
- if ($postBody) {
- $httpRequest->setPostBody($postBody);
- }
- return $httpRequest;
- }
-
- return Google_REST::execute($httpRequest);
- }
-
- public function useObjects() {
- global $apiConfig;
- return (isset($apiConfig['use_objects']) && $apiConfig['use_objects']);
- }
-
- protected function stripNull(&$o) {
- $o = (array) $o;
- foreach ($o as $k => $v) {
- if ($v === null || strstr($k, "\0*\0__")) {
- unset($o[$k]);
- }
- elseif (is_object($v) || is_array($v)) {
- $this->stripNull($o[$k]);
- }
- }
- }
-}
diff --git a/apps/files_external/ajax/google.php b/apps/files_external/ajax/google.php
index 40c10aa5d07..b80f24bbd2c 100644
--- a/apps/files_external/ajax/google.php
+++ b/apps/files_external/ajax/google.php
@@ -1,7 +1,7 @@
<?php
set_include_path(get_include_path().PATH_SEPARATOR.
\OC_App::getAppPath('files_external').'/3rdparty/google-api-php-client/src');
-require_once 'Google_Client.php';
+require_once 'Google/Client.php';
OCP\JSON::checkAppEnabled('files_external');
OCP\JSON::checkLoggedIn();
@@ -14,6 +14,7 @@ if (isset($_POST['client_id']) && isset($_POST['client_secret']) && isset($_POST
$client->setClientSecret($_POST['client_secret']);
$client->setRedirectUri($_POST['redirect']);
$client->setScopes(array('https://www.googleapis.com/auth/drive'));
+ $client->setAccessType('offline');
if (isset($_POST['step'])) {
$step = $_POST['step'];
if ($step == 1) {
diff --git a/apps/files_external/lib/api.php b/apps/files_external/lib/api.php
index 81ebd4e886a..3b5e0e1759a 100644
--- a/apps/files_external/lib/api.php
+++ b/apps/files_external/lib/api.php
@@ -45,10 +45,10 @@ class Api {
$isSystemMount = !$mountConfig['personal'];
- $permissions = \OCP\PERMISSION_READ;
+ $permissions = \OCP\Constants::PERMISSION_READ;
// personal mounts can be deleted
if (!$isSystemMount) {
- $permissions |= \OCP\PERMISSION_DELETE;
+ $permissions |= \OCP\Constants::PERMISSION_DELETE;
}
$entry = array(
diff --git a/apps/files_external/lib/google.php b/apps/files_external/lib/google.php
index a4337bc937b..c414e34fad4 100644
--- a/apps/files_external/lib/google.php
+++ b/apps/files_external/lib/google.php
@@ -23,11 +23,12 @@ namespace OC\Files\Storage;
set_include_path(get_include_path().PATH_SEPARATOR.
\OC_App::getAppPath('files_external').'/3rdparty/google-api-php-client/src');
-require_once 'Google_Client.php';
-require_once 'contrib/Google_DriveService.php';
+require_once 'Google/Client.php';
+require_once 'Google/Service/Drive.php';
class Google extends \OC\Files\Storage\Common {
+ private $client;
private $id;
private $service;
private $driveFiles;
@@ -46,14 +47,19 @@ class Google extends \OC\Files\Storage\Common {
&& isset($params['client_id']) && isset($params['client_secret'])
&& isset($params['token'])
) {
- $client = new \Google_Client();
- $client->setClientId($params['client_id']);
- $client->setClientSecret($params['client_secret']);
- $client->setScopes(array('https://www.googleapis.com/auth/drive'));
- $client->setUseObjects(true);
- $client->setAccessToken($params['token']);
+ $this->client = new \Google_Client();
+ $this->client->setClientId($params['client_id']);
+ $this->client->setClientSecret($params['client_secret']);
+ $this->client->setScopes(array('https://www.googleapis.com/auth/drive'));
+ $this->client->setAccessToken($params['token']);
+ // if curl isn't available we're likely to run into
+ // https://github.com/google/google-api-php-client/issues/59
+ // - disable gzip to avoid it.
+ if (!function_exists('curl_version') || !function_exists('curl_exec')) {
+ $this->client->setClassConfig("Google_Http_Request", "disable_gzip", true);
+ }
// note: API connection is lazy
- $this->service = new \Google_DriveService($client);
+ $this->service = new \Google_Service_Drive($this->client);
$token = json_decode($params['token'], true);
$this->id = 'google::'.substr($params['client_id'], 0, 30).$token['created'];
} else {
@@ -66,9 +72,10 @@ class Google extends \OC\Files\Storage\Common {
}
/**
- * Get the Google_DriveFile object for the specified path
+ * Get the Google_Service_Drive_DriveFile object for the specified path.
+ * Returns false on failure.
* @param string $path
- * @return string
+ * @return \Google_Service_Drive_DriveFile|false
*/
private function getDriveFile($path) {
// Remove leading and trailing slashes
@@ -115,7 +122,7 @@ class Google extends \OC\Files\Storage\Common {
$pathWithoutExt = substr($path, 0, $pos);
$file = $this->getDriveFile($pathWithoutExt);
if ($file) {
- // Switch cached Google_DriveFile to the correct index
+ // Switch cached Google_Service_Drive_DriveFile to the correct index
unset($this->driveFiles[$pathWithoutExt]);
$this->driveFiles[$path] = $file;
$parentId = $file->getId();
@@ -133,9 +140,9 @@ class Google extends \OC\Files\Storage\Common {
}
/**
- * Set the Google_DriveFile object in the cache
+ * Set the Google_Service_Drive_DriveFile object in the cache
* @param string $path
- * @param Google_DriveFile|false $file
+ * @param Google_Service_Drive_DriveFile|false $file
*/
private function setDriveFile($path, $file) {
$path = trim($path, '/');
@@ -188,10 +195,10 @@ class Google extends \OC\Files\Storage\Common {
if (!$this->is_dir($path)) {
$parentFolder = $this->getDriveFile(dirname($path));
if ($parentFolder) {
- $folder = new \Google_DriveFile();
+ $folder = new \Google_Service_Drive_DriveFile();
$folder->setTitle(basename($path));
$folder->setMimeType(self::FOLDER);
- $parent = new \Google_ParentReference();
+ $parent = new \Google_Service_Drive_ParentReference();
$parent->setId($parentFolder->getId());
$folder->setParents(array($parent));
$result = $this->service->files->insert($folder);
@@ -266,7 +273,7 @@ class Google extends \OC\Files\Storage\Common {
$this->onDuplicateFileDetected($filepath);
}
} else {
- // Cache the Google_DriveFile for future use
+ // Cache the Google_Service_Drive_DriveFile for future use
$this->setDriveFile($filepath, $child);
$files[] = $name;
}
@@ -356,7 +363,7 @@ class Google extends \OC\Files\Storage\Common {
// Change file parent
$parentFolder2 = $this->getDriveFile(dirname($path2));
if ($parentFolder2) {
- $parent = new \Google_ParentReference();
+ $parent = new \Google_Service_Drive_ParentReference();
$parent->setId($parentFolder2->getId());
$file->setParents(array($parent));
} else {
@@ -395,8 +402,8 @@ class Google extends \OC\Files\Storage\Common {
$downloadUrl = $file->getDownloadUrl();
}
if (isset($downloadUrl)) {
- $request = new \Google_HttpRequest($downloadUrl, 'GET', null, null);
- $httpRequest = \Google_Client::$io->authenticatedRequest($request);
+ $request = new \Google_Http_Request($downloadUrl, 'GET', null, null);
+ $httpRequest = $this->client->getAuth()->authenticatedRequest($request);
if ($httpRequest->getResponseHttpCode() == 200) {
$tmpFile = \OC_Helper::tmpFile($ext);
$data = $httpRequest->getResponseBody();
@@ -440,16 +447,17 @@ class Google extends \OC\Files\Storage\Common {
$params = array(
'data' => $data,
'mimeType' => $mimetype,
+ 'uploadType' => 'media'
);
$result = false;
if ($this->file_exists($path)) {
$file = $this->getDriveFile($path);
$result = $this->service->files->update($file->getId(), $file, $params);
} else {
- $file = new \Google_DriveFile();
+ $file = new \Google_Service_Drive_DriveFile();
$file->setTitle(basename($path));
$file->setMimeType($mimetype);
- $parent = new \Google_ParentReference();
+ $parent = new \Google_Service_Drive_ParentReference();
$parent->setId($parentFolder->getId());
$file->setParents(array($parent));
$result = $this->service->files->insert($file, $params);
@@ -509,9 +517,9 @@ class Google extends \OC\Files\Storage\Common {
} else {
$parentFolder = $this->getDriveFile(dirname($path));
if ($parentFolder) {
- $file = new \Google_DriveFile();
+ $file = new \Google_Service_Drive_DriveFile();
$file->setTitle(basename($path));
- $parent = new \Google_ParentReference();
+ $parent = new \Google_Service_Drive_ParentReference();
$parent->setId($parentFolder->getId());
$file->setParents(array($parent));
$result = $this->service->files->insert($file);
diff --git a/apps/files_external/lib/smb.php b/apps/files_external/lib/smb.php
index 6e53c4a9931..3f0b0f45bfb 100644
--- a/apps/files_external/lib/smb.php
+++ b/apps/files_external/lib/smb.php
@@ -139,13 +139,8 @@ class SMB extends \OC\Files\Storage\StreamWrapper{
* check if smbclient is installed
*/
public static function checkDependencies() {
- if (function_exists('shell_exec')) {
- $output=shell_exec('command -v smbclient 2> /dev/null');
- if (!empty($output)) {
- return true;
- }
- }
- return array('smbclient');
+ $smbClientExists = (bool) \OC_Helper::findBinaryPath('smbclient');
+ return $smbClientExists ? true : array('smbclient');
}
}
diff --git a/apps/files_sharing/ajax/list.php b/apps/files_sharing/ajax/list.php
index 7e2e54a1bd9..073c86365be 100644
--- a/apps/files_sharing/ajax/list.php
+++ b/apps/files_sharing/ajax/list.php
@@ -65,7 +65,7 @@ $formattedFiles = array();
foreach ($files as $file) {
$entry = \OCA\Files\Helper::formatFileInfo($file);
unset($entry['directory']); // for now
- $entry['permissions'] = \OCP\PERMISSION_READ;
+ $entry['permissions'] = \OCP\Constants::PERMISSION_READ;
$formattedFiles[] = $entry;
}
@@ -78,7 +78,7 @@ $permissions = $linkItem['permissions'];
// if globally disabled
if (\OC::$server->getAppConfig()->getValue('core', 'shareapi_allow_public_upload', 'yes') === 'no') {
// only allow reading
- $permissions = \OCP\PERMISSION_READ;
+ $permissions = \OCP\Constants::PERMISSION_READ;
}
$data['permissions'] = $permissions;
diff --git a/apps/files_sharing/ajax/shareinfo.php b/apps/files_sharing/ajax/shareinfo.php
index e87b0779e8d..f196a67a9dd 100644
--- a/apps/files_sharing/ajax/shareinfo.php
+++ b/apps/files_sharing/ajax/shareinfo.php
@@ -31,7 +31,7 @@ $linkItem = $data['linkItem'];
// Load the files
$path = $data['realPath'];
-$isWritable = $linkItem['permissions'] & (\OCP\PERMISSION_UPDATE | \OCP\PERMISSION_CREATE);
+$isWritable = $linkItem['permissions'] & (\OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_CREATE);
if (!$isWritable) {
\OC\Files\Filesystem::addStorageWrapper('readonly', function ($mountPoint, $storage) {
return new \OCA\Files_Sharing\ReadOnlyWrapper(array('storage' => $storage));
diff --git a/apps/files_sharing/l10n/ca.js b/apps/files_sharing/l10n/ca.js
index 51153252cba..4a22d71fb59 100644
--- a/apps/files_sharing/l10n/ca.js
+++ b/apps/files_sharing/l10n/ca.js
@@ -4,10 +4,10 @@ OC.L10N.register(
"Server to server sharing is not enabled on this server" : "La compartició entre servidors no està activada en aquest servidor",
"Invalid or untrusted SSL certificate" : "El certificat SSL és invàlid o no és fiable",
"Couldn't add remote share" : "No s'ha pogut afegir una compartició remota",
- "Shared with you" : "Compartit amb vós",
- "Shared with others" : "Compartit amb altres",
+ "Shared with you" : "Us han compartit",
+ "Shared with others" : "Heu compartit",
"Shared by link" : "Compartit amb enllaç",
- "No files have been shared with you yet." : "Encara no hi ha fitxers compartits amb vós.",
+ "No files have been shared with you yet." : "Encara no us han compartit fitxters.",
"You haven't shared any files yet." : "Encara no heu compartit cap fitxer.",
"You haven't shared any files by link yet." : "Encara no heu compartit cap fitxer amb enllaç.",
"Do you want to add the remote share {name} from {owner}@{remote}?" : "Voleu afegir la compartició remota {nom} des de {owner}@{remote}?",
diff --git a/apps/files_sharing/l10n/ca.json b/apps/files_sharing/l10n/ca.json
index 88d2fa70811..83668750494 100644
--- a/apps/files_sharing/l10n/ca.json
+++ b/apps/files_sharing/l10n/ca.json
@@ -2,10 +2,10 @@
"Server to server sharing is not enabled on this server" : "La compartició entre servidors no està activada en aquest servidor",
"Invalid or untrusted SSL certificate" : "El certificat SSL és invàlid o no és fiable",
"Couldn't add remote share" : "No s'ha pogut afegir una compartició remota",
- "Shared with you" : "Compartit amb vós",
- "Shared with others" : "Compartit amb altres",
+ "Shared with you" : "Us han compartit",
+ "Shared with others" : "Heu compartit",
"Shared by link" : "Compartit amb enllaç",
- "No files have been shared with you yet." : "Encara no hi ha fitxers compartits amb vós.",
+ "No files have been shared with you yet." : "Encara no us han compartit fitxters.",
"You haven't shared any files yet." : "Encara no heu compartit cap fitxer.",
"You haven't shared any files by link yet." : "Encara no heu compartit cap fitxer amb enllaç.",
"Do you want to add the remote share {name} from {owner}@{remote}?" : "Voleu afegir la compartició remota {nom} des de {owner}@{remote}?",
diff --git a/apps/files_sharing/lib/controllers/sharecontroller.php b/apps/files_sharing/lib/controllers/sharecontroller.php
index 552d9164344..0a0594ed8ff 100644
--- a/apps/files_sharing/lib/controllers/sharecontroller.php
+++ b/apps/files_sharing/lib/controllers/sharecontroller.php
@@ -23,7 +23,6 @@ use OCP\AppFramework\Controller;
use OCP\IRequest;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Http\RedirectResponse;
-use OCP\AppFramework\IApi;
use OC\URLGenerator;
use OC\AppConfig;
use OCP\ILogger;
@@ -84,7 +83,6 @@ class ShareController extends Controller {
* @NoCSRFRequired
*
* @param string $token
- *
* @return TemplateResponse|RedirectResponse
*/
public function showAuthenticate($token) {
@@ -127,7 +125,6 @@ class ShareController extends Controller {
*
* @param string $token
* @param string $path
- *
* @return TemplateResponse
*/
public function showShare($token, $path = '') {
@@ -161,7 +158,6 @@ class ShareController extends Controller {
$originalSharePath .= $path;
}
- $dir = dirname($originalSharePath);
$file = basename($originalSharePath);
$shareTmpl = array();
@@ -173,7 +169,7 @@ class ShareController extends Controller {
$shareTmpl['sharingToken'] = $token;
$shareTmpl['server2serversharing'] = Helper::isOutgoingServer2serverShareEnabled();
$shareTmpl['protected'] = isset($linkItem['share_with']) ? 'true' : 'false';
- $shareTmpl['dir'] = $dir;
+ $shareTmpl['dir'] = '';
$shareTmpl['fileSize'] = \OCP\Util::humanFileSize(\OC\Files\Filesystem::filesize($originalSharePath));
// Show file list
@@ -186,7 +182,7 @@ class ShareController extends Controller {
$folder = new Template('files', 'list', '');
$folder->assign('dir', $getPath);
$folder->assign('dirToken', $linkItem['token']);
- $folder->assign('permissions', OCP\PERMISSION_READ);
+ $folder->assign('permissions', \OCP\Constants::PERMISSION_READ);
$folder->assign('isPublic', true);
$folder->assign('publicUploadEnabled', 'no');
$folder->assign('files', $files);
@@ -207,6 +203,7 @@ class ShareController extends Controller {
/**
* @PublicPage
* @NoCSRFRequired
+ *
* @param string $token
* @param string $files
* @param string $path
@@ -240,7 +237,7 @@ class ShareController extends Controller {
}
// FIXME: The exit is required here because otherwise the AppFramework is trying to add headers as well
- // after dispatching the request which results in a "Cannot modify header information" notice.
+ // after dispatching the request which results in a "Cannot modify header information" notice.
OC_Files::get($originalSharePath, $files_list, $_SERVER['REQUEST_METHOD'] == 'HEAD');
exit();
} else {
diff --git a/apps/files_sharing/lib/readonlycache.php b/apps/files_sharing/lib/readonlycache.php
index f129ca49433..6dd3b9cf61d 100644
--- a/apps/files_sharing/lib/readonlycache.php
+++ b/apps/files_sharing/lib/readonlycache.php
@@ -13,14 +13,14 @@ use OC\Files\Cache\Cache;
class ReadOnlyCache extends Cache {
public function get($path) {
$data = parent::get($path);
- $data['permissions'] &= (\OCP\PERMISSION_READ | \OCP\PERMISSION_SHARE);
+ $data['permissions'] &= (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE);
return $data;
}
public function getFolderContents($path) {
$content = parent::getFolderContents($path);
foreach ($content as &$data) {
- $data['permissions'] &= (\OCP\PERMISSION_READ | \OCP\PERMISSION_SHARE);
+ $data['permissions'] &= (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE);
}
return $content;
}
diff --git a/apps/files_sharing/lib/readonlywrapper.php b/apps/files_sharing/lib/readonlywrapper.php
index 45ed3fd68bb..58a5695aff8 100644
--- a/apps/files_sharing/lib/readonlywrapper.php
+++ b/apps/files_sharing/lib/readonlywrapper.php
@@ -24,7 +24,7 @@ class ReadOnlyWrapper extends Wrapper {
}
public function getPermissions($path) {
- return $this->storage->getPermissions($path) & (\OCP\PERMISSION_READ | \OCP\PERMISSION_SHARE);
+ return $this->storage->getPermissions($path) & (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE);
}
public function rename($path1, $path2) {
diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php
index 19ee6085e47..1ac57053e25 100644
--- a/apps/files_sharing/lib/sharedstorage.php
+++ b/apps/files_sharing/lib/sharedstorage.php
@@ -67,7 +67,7 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage {
if ($source) {
$source['path'] .= '.part';
// All partial files have delete permission
- $source['permissions'] |= \OCP\PERMISSION_DELETE;
+ $source['permissions'] |= \OCP\Constants::PERMISSION_DELETE;
}
} else {
$source = \OC_Share_Backend_File::getSource($target, $this->getMountPoint(), $this->getItemType());
@@ -109,11 +109,11 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage {
$permissions = $this->share['permissions'];
// part files and the mount point always have delete permissions
if ($target === '' || pathinfo($target, PATHINFO_EXTENSION) === 'part') {
- $permissions |= \OCP\PERMISSION_DELETE;
+ $permissions |= \OCP\Constants::PERMISSION_DELETE;
}
if (\OC_Util::isSharingDisabledForUser()) {
- $permissions &= ~\OCP\PERMISSION_SHARE;
+ $permissions &= ~\OCP\Constants::PERMISSION_SHARE;
}
return $permissions;
@@ -197,7 +197,7 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage {
}
public function isCreatable($path) {
- return ($this->getPermissions($path) & \OCP\PERMISSION_CREATE);
+ return ($this->getPermissions($path) & \OCP\Constants::PERMISSION_CREATE);
}
public function isReadable($path) {
@@ -205,18 +205,18 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage {
}
public function isUpdatable($path) {
- return ($this->getPermissions($path) & \OCP\PERMISSION_UPDATE);
+ return ($this->getPermissions($path) & \OCP\Constants::PERMISSION_UPDATE);
}
public function isDeletable($path) {
- return ($this->getPermissions($path) & \OCP\PERMISSION_DELETE);
+ return ($this->getPermissions($path) & \OCP\Constants::PERMISSION_DELETE);
}
public function isSharable($path) {
if (\OCP\Util::isSharingDisabledForUser()) {
return false;
}
- return ($this->getPermissions($path) & \OCP\PERMISSION_SHARE);
+ return ($this->getPermissions($path) & \OCP\Constants::PERMISSION_SHARE);
}
public function file_exists($path) {
diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php
index d9b8f0f4f30..d9d14f67c33 100644
--- a/apps/files_sharing/public.php
+++ b/apps/files_sharing/public.php
@@ -12,6 +12,6 @@
$urlGenerator = new \OC\URLGenerator(\OC::$server->getConfig());
$token = isset($_GET['t']) ? $_GET['t'] : '';
-$route = isset($_GET['download']) ? 'files_sharing.sharecontroller.downloadshare' : 'files_sharing.sharecontroller.showshare';
+$route = isset($_GET['download']) ? 'files_sharing.sharecontroller.downloadShare' : 'files_sharing.sharecontroller.showShare';
OC_Response::redirect($urlGenerator->linkToRoute($route, array('token' => $token)));
diff --git a/apps/files_sharing/publicwebdav.php b/apps/files_sharing/publicwebdav.php
index 03e43967a40..2c7ccf8d92c 100644
--- a/apps/files_sharing/publicwebdav.php
+++ b/apps/files_sharing/publicwebdav.php
@@ -41,7 +41,7 @@ $server->addPlugin(new OC_Connector_Sabre_ExceptionLoggerPlugin('webdav'));
$server->subscribeEvent('beforeMethod', function () use ($server, $objectTree, $authBackend) {
$share = $authBackend->getShare();
$owner = $share['uid_owner'];
- $isWritable = $share['permissions'] & (\OCP\PERMISSION_UPDATE | \OCP\PERMISSION_CREATE);
+ $isWritable = $share['permissions'] & (\OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_CREATE);
$fileId = $share['file_source'];
if (!$isWritable) {
diff --git a/apps/files_sharing/tests/api.php b/apps/files_sharing/tests/api.php
index e550dcc27db..1259197423b 100644
--- a/apps/files_sharing/tests/api.php
+++ b/apps/files_sharing/tests/api.php
@@ -788,7 +788,7 @@ class Test_Files_Sharing_Api extends TestCase {
$fileInfo = $this->view->getFileInfo($this->filename);
$result = \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER,
- \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2, \OCP\PERMISSION_ALL);
+ \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2, \OCP\Constants::PERMISSION_ALL);
// share was successful?
$this->assertTrue($result);
@@ -822,7 +822,7 @@ class Test_Files_Sharing_Api extends TestCase {
// check if share have expected permissions, single shared files never have
// delete permissions
- $this->assertEquals(\OCP\PERMISSION_ALL & ~\OCP\PERMISSION_DELETE, $userShare['permissions']);
+ $this->assertEquals(\OCP\Constants::PERMISSION_ALL & ~\OCP\Constants::PERMISSION_DELETE, $userShare['permissions']);
// update permissions
@@ -1228,7 +1228,7 @@ class Test_Files_Sharing_Api extends TestCase {
$info = OC\Files\Filesystem::getFileInfo($this->filename);
$this->assertTrue($info instanceof \OC\Files\FileInfo);
- $result = \OCP\Share::shareItem('file', $info->getId(), \OCP\Share::SHARE_TYPE_LINK, null, \OCP\PERMISSION_READ);
+ $result = \OCP\Share::shareItem('file', $info->getId(), \OCP\Share::SHARE_TYPE_LINK, null, \OCP\Constants::PERMISSION_READ);
$this->assertTrue(is_string($result));
$result = \OCP\Share::shareItem('file', $info->getId(), \OCP\Share::SHARE_TYPE_USER, \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2, 31);
diff --git a/apps/files_sharing/tests/cache.php b/apps/files_sharing/tests/cache.php
index b6a44f464f9..aec1983bad3 100644
--- a/apps/files_sharing/tests/cache.php
+++ b/apps/files_sharing/tests/cache.php
@@ -348,7 +348,7 @@ class Test_Files_Sharing_Cache extends TestCase {
self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
\OC\Files\Filesystem::file_put_contents('test.txt', 'foo');
$info = \OC\Files\Filesystem::getFileInfo('test.txt');
- \OCP\Share::shareItem('file', $info->getId(), \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, \OCP\PERMISSION_ALL);
+ \OCP\Share::shareItem('file', $info->getId(), \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, \OCP\Constants::PERMISSION_ALL);
\OC_Util::tearDownFS();
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
@@ -369,7 +369,7 @@ class Test_Files_Sharing_Cache extends TestCase {
\OC\Files\Filesystem::touch('foo/bar/test.txt');
$folderInfo = \OC\Files\Filesystem::getFileInfo('foo');
$fileInfo = \OC\Files\Filesystem::getFileInfo('foo/bar/test.txt');
- \OCP\Share::shareItem('folder', $folderInfo->getId(), \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, \OCP\PERMISSION_ALL);
+ \OCP\Share::shareItem('folder', $folderInfo->getId(), \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, \OCP\Constants::PERMISSION_ALL);
\OC_Util::tearDownFS();
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
diff --git a/apps/files_sharing/tests/controller/sharecontroller.php b/apps/files_sharing/tests/controller/sharecontroller.php
index 8dcb2475564..f13e5b2e497 100644
--- a/apps/files_sharing/tests/controller/sharecontroller.php
+++ b/apps/files_sharing/tests/controller/sharecontroller.php
@@ -153,7 +153,7 @@ class ShareControllerTest extends \PHPUnit_Framework_TestCase {
'sharingToken' => $this->token,
'server2serversharing' => true,
'protected' => 'true',
- 'dir' => '/',
+ 'dir' => '',
'downloadURL' => null,
'fileSize' => '33 B'
);
diff --git a/apps/files_sharing/tests/share.php b/apps/files_sharing/tests/share.php
index 4318d3c510e..f76f92734d0 100644
--- a/apps/files_sharing/tests/share.php
+++ b/apps/files_sharing/tests/share.php
@@ -105,12 +105,12 @@ class Test_Files_Sharing extends OCA\Files_sharing\Tests\TestCase {
$fileinfo = $this->view->getFileInfo($this->filename);
$result = \OCP\Share::shareItem('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_GROUP,
- \Test_Files_Sharing::TEST_FILES_SHARING_API_GROUP1, \OCP\PERMISSION_READ);
+ \Test_Files_Sharing::TEST_FILES_SHARING_API_GROUP1, \OCP\Constants::PERMISSION_READ);
$this->assertTrue($result);
$result = \OCP\Share::shareItem('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER,
- \Test_Files_Sharing::TEST_FILES_SHARING_API_USER2, \OCP\PERMISSION_UPDATE);
+ \Test_Files_Sharing::TEST_FILES_SHARING_API_USER2, \OCP\Constants::PERMISSION_UPDATE);
$this->assertTrue($result);
@@ -124,7 +124,7 @@ class Test_Files_Sharing extends OCA\Files_sharing\Tests\TestCase {
$this->assertSame(1, count($result));
$share = reset($result);
- $this->assertSame(\OCP\PERMISSION_READ | \OCP\PERMISSION_UPDATE, $share['permissions']);
+ $this->assertSame(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE, $share['permissions']);
\OC\Files\Filesystem::rename($this->filename, $this->filename . '-renamed');
@@ -136,7 +136,7 @@ class Test_Files_Sharing extends OCA\Files_sharing\Tests\TestCase {
$this->assertSame(1, count($result));
$share = reset($result);
- $this->assertSame(\OCP\PERMISSION_READ | \OCP\PERMISSION_UPDATE, $share['permissions']);
+ $this->assertSame(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE, $share['permissions']);
$this->assertSame($this->filename . '-renamed', $share['file_target']);
self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
@@ -157,7 +157,7 @@ class Test_Files_Sharing extends OCA\Files_sharing\Tests\TestCase {
$share = reset($result);
// only the group share permissions should be available now
- $this->assertSame(\OCP\PERMISSION_READ, $share['permissions']);
+ $this->assertSame(\OCP\Constants::PERMISSION_READ, $share['permissions']);
$this->assertSame($this->filename . '-renamed', $share['file_target']);
}
@@ -172,8 +172,8 @@ class Test_Files_Sharing extends OCA\Files_sharing\Tests\TestCase {
$fileinfo = $this->view->getFileInfo($this->filename);
// share the file to group1 (user2 is a member of this group) and explicitely to user2
- \OCP\Share::shareItem('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1, \OCP\PERMISSION_ALL);
- \OCP\Share::shareItem('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, \OCP\PERMISSION_ALL);
+ \OCP\Share::shareItem('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1, \OCP\Constants::PERMISSION_ALL);
+ \OCP\Share::shareItem('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, \OCP\Constants::PERMISSION_ALL);
// user1 should have to shared files
$shares = \OCP\Share::getItemsShared('file');
@@ -203,7 +203,7 @@ class Test_Files_Sharing extends OCA\Files_sharing\Tests\TestCase {
$this->assertSame(1, count($shares));
// user1 shares a gain the file directly to user2
- \OCP\Share::shareItem('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, \OCP\PERMISSION_ALL);
+ \OCP\Share::shareItem('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, \OCP\Constants::PERMISSION_ALL);
// user2 should see again welcome.txt and the shared file
\Test_Files_Sharing::loginHelper(self::TEST_FILES_SHARING_API_USER2);
@@ -271,14 +271,14 @@ class Test_Files_Sharing extends OCA\Files_sharing\Tests\TestCase {
}
function DataProviderTestFileSharePermissions() {
- $permission1 = \OCP\PERMISSION_ALL;
- $permission3 = \OCP\PERMISSION_READ;
- $permission4 = \OCP\PERMISSION_READ | \OCP\PERMISSION_UPDATE;
- $permission5 = \OCP\PERMISSION_READ | \OCP\PERMISSION_DELETE;
- $permission6 = \OCP\PERMISSION_READ | \OCP\PERMISSION_UPDATE | \OCP\PERMISSION_DELETE;
+ $permission1 = \OCP\Constants::PERMISSION_ALL;
+ $permission3 = \OCP\Constants::PERMISSION_READ;
+ $permission4 = \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE;
+ $permission5 = \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_DELETE;
+ $permission6 = \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE;
return array(
- array($permission1, \OCP\PERMISSION_ALL & ~\OCP\PERMISSION_DELETE),
+ array($permission1, \OCP\Constants::PERMISSION_ALL & ~\OCP\Constants::PERMISSION_DELETE),
array($permission3, $permission3),
array($permission4, $permission4),
array($permission5, $permission3),
diff --git a/apps/files_trashbin/l10n/af_ZA.js b/apps/files_trashbin/l10n/af_ZA.js
new file mode 100644
index 00000000000..bde70775250
--- /dev/null
+++ b/apps/files_trashbin/l10n/af_ZA.js
@@ -0,0 +1,6 @@
+OC.L10N.register(
+ "files_trashbin",
+ {
+ "Error" : "Fout"
+},
+"nplurals=2; plural=(n != 1);");
diff --git a/apps/files_trashbin/l10n/af_ZA.json b/apps/files_trashbin/l10n/af_ZA.json
new file mode 100644
index 00000000000..0ed511058ba
--- /dev/null
+++ b/apps/files_trashbin/l10n/af_ZA.json
@@ -0,0 +1,4 @@
+{ "translations": {
+ "Error" : "Fout"
+},"pluralForm" :"nplurals=2; plural=(n != 1);"
+} \ No newline at end of file
diff --git a/apps/files_trashbin/lib/helper.php b/apps/files_trashbin/lib/helper.php
index c2b81e3dbc8..c99662480df 100644
--- a/apps/files_trashbin/lib/helper.php
+++ b/apps/files_trashbin/lib/helper.php
@@ -88,7 +88,7 @@ class Helper
$entry = \OCA\Files\Helper::formatFileInfo($i);
$entry['id'] = $id++;
$entry['etag'] = $entry['mtime']; // add fake etag, it is only needed to identify the preview image
- $entry['permissions'] = \OCP\PERMISSION_READ;
+ $entry['permissions'] = \OCP\Constants::PERMISSION_READ;
if (\OCP\App::isEnabled('files_encryption')) {
$entry['isPreviewAvailable'] = false;
}
diff --git a/apps/files_versions/tests/versions.php b/apps/files_versions/tests/versions.php
index 436863b28dc..6205a6881f0 100644
--- a/apps/files_versions/tests/versions.php
+++ b/apps/files_versions/tests/versions.php
@@ -277,7 +277,7 @@ class Test_Files_Versioning extends \Test\TestCase {
$this->rootView->file_put_contents($v1, 'version1');
$this->rootView->file_put_contents($v2, 'version2');
- \OCP\Share::shareItem('folder', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_VERSIONS_USER2, OCP\PERMISSION_ALL);
+ \OCP\Share::shareItem('folder', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_VERSIONS_USER2, \OCP\Constants::PERMISSION_ALL);
self::loginHelper(self::TEST_VERSIONS_USER2);
@@ -320,7 +320,7 @@ class Test_Files_Versioning extends \Test\TestCase {
$this->rootView->file_put_contents($v1, 'version1');
$this->rootView->file_put_contents($v2, 'version2');
- \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_VERSIONS_USER2, OCP\PERMISSION_ALL);
+ \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_VERSIONS_USER2, \OCP\Constants::PERMISSION_ALL);
self::loginHelper(self::TEST_VERSIONS_USER2);
diff --git a/apps/user_ldap/ajax/wizard.php b/apps/user_ldap/ajax/wizard.php
index ef1241b9147..6d7d70c8c5a 100644
--- a/apps/user_ldap/ajax/wizard.php
+++ b/apps/user_ldap/ajax/wizard.php
@@ -62,6 +62,7 @@ switch($action) {
case 'guessPortAndTLS':
case 'guessBaseDN':
case 'detectEmailAttribute':
+ case 'detectUserDisplayNameAttribute':
case 'determineGroupMemberAssoc':
case 'determineUserObjectClasses':
case 'determineGroupObjectClasses':
@@ -115,4 +116,3 @@ switch($action) {
//TODO: return 4xx error
break;
}
-
diff --git a/apps/user_ldap/js/ldapFilter.js b/apps/user_ldap/js/ldapFilter.js
index bb66c1df2ee..0f7d240adac 100644
--- a/apps/user_ldap/js/ldapFilter.js
+++ b/apps/user_ldap/js/ldapFilter.js
@@ -8,6 +8,7 @@ function LdapFilter(target, determineModeCallback) {
this.determineModeCallback = determineModeCallback;
this.foundFeatures = false;
this.activated = false;
+ this.countPending = false;
if( target === 'User' ||
target === 'Login' ||
@@ -25,9 +26,13 @@ LdapFilter.prototype.activate = function() {
this.determineMode();
};
-LdapFilter.prototype.compose = function(callback) {
+LdapFilter.prototype.compose = function(updateCount) {
var action;
+ if(updateCount === true) {
+ this.countPending = updateCount;
+ }
+
if(this.locked) {
this.lazyRunCompose = true;
return false;
@@ -54,22 +59,36 @@ LdapFilter.prototype.compose = function(callback) {
LdapWizard.ajax(param,
function(result) {
- LdapWizard.applyChanges(result);
- filter.updateCount();
- if(filter.target === 'Group') {
- LdapWizard.detectGroupMemberAssoc();
- }
- if(typeof callback !== 'undefined') {
- callback();
- }
+ filter.afterComposeSuccess(result);
},
function () {
+ filter.countPending = false;
console.log('LDAP Wizard: could not compose filter. '+
'Please check owncloud.log');
}
);
};
+/**
+ * this function is triggered after attribute detectors have completed in
+ * LdapWizard
+ */
+LdapFilter.prototype.afterDetectorsRan = function() {
+ this.updateCount();
+};
+
+/**
+ * this function is triggered after LDAP filters have been composed successfully
+ * @param {object} result returned by the ajax call
+ */
+LdapFilter.prototype.afterComposeSuccess = function(result) {
+ LdapWizard.applyChanges(result);
+ if(this.countPending) {
+ this.countPending = false;
+ this.updateCount();
+ }
+};
+
LdapFilter.prototype.determineMode = function() {
var param = 'action=get'+encodeURIComponent(this.target)+'FilterMode'+
'&ldap_serverconfig_chooser='+
@@ -145,10 +164,26 @@ LdapFilter.prototype.findFeatures = function() {
}
};
+/**
+ * this function is triggered before user and group counts are executed
+ * resolving the passed status variable will fire up counting
+ * @param {object} status an instance of $.Deferred
+ */
+LdapFilter.prototype.beforeUpdateCount = function() {
+ var status = $.Deferred();
+ LdapWizard.runDetectors(this.target, function() {
+ status.resolve();
+ });
+ return status;
+};
+
LdapFilter.prototype.updateCount = function(doneCallback) {
- if(this.target === 'User') {
- LdapWizard.countUsers(doneCallback);
- } else if (this.target === 'Group') {
- LdapWizard.countGroups(doneCallback);
- }
+ var filter = this;
+ $.when(this.beforeUpdateCount()).done(function() {
+ if(filter.target === 'User') {
+ LdapWizard.countUsers(doneCallback);
+ } else if (filter.target === 'Group') {
+ LdapWizard.countGroups(doneCallback);
+ }
+ });
};
diff --git a/apps/user_ldap/js/settings.js b/apps/user_ldap/js/settings.js
index fa40aba73b4..6db210fe435 100644
--- a/apps/user_ldap/js/settings.js
+++ b/apps/user_ldap/js/settings.js
@@ -151,8 +151,10 @@ var LdapWizard = {
ajaxRequests: {},
ajax: function(param, fnOnSuccess, fnOnError, reqID) {
- if(reqID !== undefined) {
+ if(!_.isUndefined(reqID)) {
if(LdapWizard.ajaxRequests.hasOwnProperty(reqID)) {
+ console.log('aborting ' + reqID);
+ console.log(param);
LdapWizard.ajaxRequests[reqID].abort();
}
}
@@ -167,9 +169,10 @@ var LdapWizard = {
}
}
);
- if(reqID !== undefined) {
+ if(!_.isUndefined(reqID)) {
LdapWizard.ajaxRequests[reqID] = request;
}
+ return request;
},
applyChanges: function (result) {
@@ -342,7 +345,7 @@ var LdapWizard = {
},
_countThings: function(method, spinnerID, doneCallback) {
- param = 'action='+method+
+ var param = 'action='+method+
'&ldap_serverconfig_chooser='+
encodeURIComponent($('#ldap_serverconfig_chooser').val());
@@ -351,14 +354,14 @@ var LdapWizard = {
function(result) {
LdapWizard.applyChanges(result);
LdapWizard.hideSpinner(spinnerID);
- if(doneCallback !== undefined) {
+ if(!_.isUndefined(doneCallback)) {
doneCallback(method);
}
},
function (result) {
OC.Notification.show('Counting the entries failed with, ' + result.message);
LdapWizard.hideSpinner(spinnerID);
- if(doneCallback !== undefined) {
+ if(!_.isUndefined(doneCallback)) {
doneCallback(method);
}
},
@@ -374,12 +377,54 @@ var LdapWizard = {
LdapWizard._countThings('countUsers', '#ldap_user_count', doneCallback);
},
+ /**
+ * called after detectors have run
+ * @callback runDetectorsCallback
+ */
+
+ /**
+ * runs detectors to determine appropriate attributes, e.g. displayName
+ * @param {string} type either "User" or "Group"
+ * @param {runDetectorsCallback} triggered after all detectors have completed
+ */
+ runDetectors: function(type, callback) {
+ if(type === 'Group') {
+ $.when(LdapWizard.detectGroupMemberAssoc())
+ .then(callback, callback);
+ if( LdapWizard.admin.isExperienced
+ && !(LdapWizard.detectorsRunInXPMode & LdapWizard.groupDetectors)) {
+ LdapWizard.detectorsRunInXPMode += LdapWizard.groupDetectors;
+ }
+ } else if(type === 'User') {
+ var req1 = LdapWizard.detectUserDisplayNameAttribute();
+ var req2 = LdapWizard.detectEmailAttribute();
+ $.when(req1, req2)
+ .then(callback, callback);
+ if( LdapWizard.admin.isExperienced
+ && !(LdapWizard.detectorsRunInXPMode & LdapWizard.userDetectors)) {
+ LdapWizard.detectorsRunInXPMode += LdapWizard.userDetectors;
+ }
+ }
+ },
+
+ /**
+ * runs detector to find out a fitting user display name attribute
+ */
+ detectUserDisplayNameAttribute: function() {
+ var param = 'action=detectUserDisplayNameAttribute' +
+ '&ldap_serverconfig_chooser='+
+ encodeURIComponent($('#ldap_serverconfig_chooser').val());
+
+ //runs in the background, no callbacks necessary
+ return LdapWizard.ajax(param, LdapWizard.applyChanges, function(){}, 'detectUserDisplayNameAttribute');
+ },
+
detectEmailAttribute: function() {
- param = 'action=detectEmailAttribute'+
+ var param = 'action=detectEmailAttribute'+
'&ldap_serverconfig_chooser='+
encodeURIComponent($('#ldap_serverconfig_chooser').val());
//runs in the background, no callbacks necessary
- LdapWizard.ajax(param, LdapWizard.applyChanges, function(){}, 'detectEmailAttribute');
+ return LdapWizard.ajax(param, LdapWizard.applyChanges, function(){}, 'detectEmailAttribute');
},
detectGroupMemberAssoc: function() {
@@ -387,7 +432,7 @@ var LdapWizard = {
'&ldap_serverconfig_chooser='+
encodeURIComponent($('#ldap_serverconfig_chooser').val());
- LdapWizard.ajax(param,
+ return LdapWizard.ajax(param,
function(result) {
//pure background story
},
@@ -409,7 +454,7 @@ var LdapWizard = {
$('#ldap_loginfilter_attributes').find('option').remove();
for (var i in result.options['ldap_loginfilter_attributes']) {
//FIXME: move HTML into template
- attr = result.options['ldap_loginfilter_attributes'][i];
+ var attr = result.options['ldap_loginfilter_attributes'][i];
$('#ldap_loginfilter_attributes').append(
"<option value='"+attr+"'>"+attr+"</option>");
}
@@ -566,8 +611,12 @@ var LdapWizard = {
},
isConfigurationActiveControlLocked: true,
+ detectorsRunInXPMode: 0,
+ userDetectors: 1,
+ groupDetectors: 2,
init: function() {
+ LdapWizard.detectorsRunInXPMode = 0;
LdapWizard.instantiateFilters();
LdapWizard.admin.setExperienced($('#ldap_experienced_admin').is(':checked'));
LdapWizard.basicStatusCheck();
@@ -620,8 +669,9 @@ var LdapWizard = {
instantiateFilters: function() {
delete LdapWizard.userFilter;
LdapWizard.userFilter = new LdapFilter('User', function(mode) {
- if(mode === LdapWizard.filterModeAssisted) {
- LdapWizard.groupFilter.updateCount();
+ if( !LdapWizard.admin.isExperienced()
+ || mode === LdapWizard.filterModeAssisted) {
+ LdapWizard.userFilter.updateCount();
}
LdapWizard.userFilter.findFeatures();
});
@@ -630,7 +680,6 @@ var LdapWizard = {
$('#ldap_user_count').text('');
LdapWizard.showSpinner('#rawUserFilterContainer .ldapGetEntryCount');
LdapWizard.userFilter.updateCount(LdapWizard.hideTestSpinner);
- LdapWizard.detectEmailAttribute();
$('#ldap_user_count').removeClass('hidden');
});
@@ -641,7 +690,8 @@ var LdapWizard = {
delete LdapWizard.groupFilter;
LdapWizard.groupFilter = new LdapFilter('Group', function(mode) {
- if(mode === LdapWizard.filterModeAssisted) {
+ if( !LdapWizard.admin.isExperienced()
+ || mode === LdapWizard.filterModeAssisted) {
LdapWizard.groupFilter.updateCount();
}
LdapWizard.groupFilter.findFeatures();
@@ -651,7 +701,6 @@ var LdapWizard = {
$('#ldap_group_count').text('');
LdapWizard.showSpinner('#rawGroupFilterContainer .ldapGetEntryCount');
LdapWizard.groupFilter.updateCount(LdapWizard.hideTestSpinner);
- LdapWizard.detectGroupMemberAssoc();
$('#ldap_group_count').removeClass('hidden');
});
},
@@ -668,7 +717,7 @@ var LdapWizard = {
postInitUserFilter: function() {
if(LdapWizard.userFilterObjectClassesHasRun &&
LdapWizard.userFilterAvailableGroupsHasRun) {
- LdapWizard.userFilter.compose(LdapWizard.detectEmailAttribute);
+ LdapWizard.userFilter.compose();
}
},
@@ -679,7 +728,7 @@ var LdapWizard = {
//do not allow to switch tabs as long as a save process is active
return false;
}
- newTabIndex = 0;
+ var newTabIndex = 0;
if(ui.newTab[0].id === '#ldapWizard2') {
LdapWizard.initUserFilter();
newTabIndex = 1;
@@ -691,9 +740,23 @@ var LdapWizard = {
newTabIndex = 3;
}
- curTabIndex = $('#ldapSettings').tabs('option', 'active');
+ var curTabIndex = $('#ldapSettings').tabs('option', 'active');
if(curTabIndex >= 0 && curTabIndex <= 3) {
LdapWizard.controlUpdate(newTabIndex);
+ //run detectors in XP mode, when "Test Filter" button has not been
+ //clicked in order to make sure that email, displayname, member-
+ //group association attributes are properly set.
+ if( curTabIndex === 1
+ && LdapWizard.admin.isExperienced
+ && !(LdapWizard.detecorsRunInXPMode & LdapWizard.userDetectors)
+ ) {
+ LdapWizard.runDetectors('User', function(){});
+ } else if( curTabIndex === 3
+ && LdapWizard.admin.isExperienced
+ && !(LdapWizard.detecorsRunInXPMode & LdapWizard.groupDetectors)
+ ) {
+ LdapWizard.runDetectors('Group', function(){});
+ }
}
},
@@ -711,15 +774,15 @@ var LdapWizard = {
}
}
- if(triggerObj.id === 'ldap_userlist_filter' && !LdapWizard.admin.isExperienced()) {
- LdapWizard.detectEmailAttribute();
- } else if(triggerObj.id === 'ldap_group_filter' && !LdapWizard.admin.isExperienced()) {
- LdapWizard.detectGroupMemberAssoc();
- }
-
if(triggerObj.id === 'ldap_loginfilter_username'
|| triggerObj.id === 'ldap_loginfilter_email') {
LdapWizard.loginFilter.compose();
+ } else if (!LdapWizard.admin.isExperienced()) {
+ if(triggerObj.id === 'ldap_userlist_filter') {
+ LdapWizard.userFilter.updateCount();
+ } else if (triggerObj.id === 'ldap_group_filter') {
+ LdapWizard.groupFilter.updateCount();
+ }
}
if($('#ldapSettings').tabs('option', 'active') == 0) {
@@ -749,7 +812,7 @@ var LdapWizard = {
LdapWizard._save($('#'+originalObj)[0], $.trim(values));
if(originalObj === 'ldap_userfilter_objectclass'
|| originalObj === 'ldap_userfilter_groups') {
- LdapWizard.userFilter.compose(LdapWizard.detectEmailAttribute);
+ LdapWizard.userFilter.compose(true);
//when user filter is changed afterwards, login filter needs to
//be adjusted, too
if(!LdapWizard.loginFilter) {
@@ -760,7 +823,7 @@ var LdapWizard = {
LdapWizard.loginFilter.compose();
} else if(originalObj === 'ldap_groupfilter_objectclass'
|| originalObj === 'ldap_groupfilter_groups') {
- LdapWizard.groupFilter.compose();
+ LdapWizard.groupFilter.compose(true);
}
},
@@ -830,10 +893,10 @@ var LdapWizard = {
LdapWizard._save({ id: modeKey }, LdapWizard.filterModeAssisted);
if(isUser) {
LdapWizard.blacklistRemove('ldap_userlist_filter');
- LdapWizard.userFilter.compose(LdapWizard.detectEmailAttribute);
+ LdapWizard.userFilter.compose(true);
} else {
LdapWizard.blacklistRemove('ldap_group_filter');
- LdapWizard.groupFilter.compose();
+ LdapWizard.groupFilter.compose(true);
}
}
},
diff --git a/apps/user_ldap/l10n/af_ZA.js b/apps/user_ldap/l10n/af_ZA.js
index fc00b542daa..610359a094c 100644
--- a/apps/user_ldap/l10n/af_ZA.js
+++ b/apps/user_ldap/l10n/af_ZA.js
@@ -1,6 +1,7 @@
OC.L10N.register(
"user_ldap",
{
+ "Error" : "Fout",
"_%s group found_::_%s groups found_" : ["",""],
"_%s user found_::_%s users found_" : ["",""],
"Help" : "Hulp",
diff --git a/apps/user_ldap/l10n/af_ZA.json b/apps/user_ldap/l10n/af_ZA.json
index ec83ea0849a..05463be095e 100644
--- a/apps/user_ldap/l10n/af_ZA.json
+++ b/apps/user_ldap/l10n/af_ZA.json
@@ -1,4 +1,5 @@
{ "translations": {
+ "Error" : "Fout",
"_%s group found_::_%s groups found_" : ["",""],
"_%s user found_::_%s users found_" : ["",""],
"Help" : "Hulp",
diff --git a/apps/user_ldap/l10n/cs_CZ.js b/apps/user_ldap/l10n/cs_CZ.js
index 2b8142bced6..f4782d57d66 100644
--- a/apps/user_ldap/l10n/cs_CZ.js
+++ b/apps/user_ldap/l10n/cs_CZ.js
@@ -33,6 +33,7 @@ OC.L10N.register(
"Confirm Deletion" : "Potvrdit smazání",
"_%s group found_::_%s groups found_" : ["nalezena %s skupina","nalezeny %s skupiny","nalezeno %s skupin"],
"_%s user found_::_%s users found_" : ["nalezen %s uživatel","nalezeni %s uživatelé","nalezeno %s uživatelů"],
+ "Could not detect user display name attribute. Please specify it yourself in advanced ldap settings." : "Nelze detekovat atribut pro zobrazení jména uživatele. Upřesněte ho prosím sami v rozšířeném nastavení LDAP.",
"Could not find the desired feature" : "Nelze nalézt požadovanou vlastnost",
"Invalid Host" : "Neplatný hostitel",
"Server" : "Server",
diff --git a/apps/user_ldap/l10n/cs_CZ.json b/apps/user_ldap/l10n/cs_CZ.json
index 819f4e6d534..e3e51560987 100644
--- a/apps/user_ldap/l10n/cs_CZ.json
+++ b/apps/user_ldap/l10n/cs_CZ.json
@@ -31,6 +31,7 @@
"Confirm Deletion" : "Potvrdit smazání",
"_%s group found_::_%s groups found_" : ["nalezena %s skupina","nalezeny %s skupiny","nalezeno %s skupin"],
"_%s user found_::_%s users found_" : ["nalezen %s uživatel","nalezeni %s uživatelé","nalezeno %s uživatelů"],
+ "Could not detect user display name attribute. Please specify it yourself in advanced ldap settings." : "Nelze detekovat atribut pro zobrazení jména uživatele. Upřesněte ho prosím sami v rozšířeném nastavení LDAP.",
"Could not find the desired feature" : "Nelze nalézt požadovanou vlastnost",
"Invalid Host" : "Neplatný hostitel",
"Server" : "Server",
diff --git a/apps/user_ldap/l10n/da.js b/apps/user_ldap/l10n/da.js
index 91bce8c777e..fb6feccc4b6 100644
--- a/apps/user_ldap/l10n/da.js
+++ b/apps/user_ldap/l10n/da.js
@@ -33,6 +33,7 @@ OC.L10N.register(
"Confirm Deletion" : "Bekræft Sletning",
"_%s group found_::_%s groups found_" : ["Der blev fundet %s gruppe","Der blev fundet %s grupper"],
"_%s user found_::_%s users found_" : ["Der blev fundet %s bruger","Der blev fundet %s brugere"],
+ "Could not detect user display name attribute. Please specify it yourself in advanced ldap settings." : "Kunne ikke registrere navneattributten for visning af bruger. Angiv den venligst selv i de avancerede ldap-indstillinger.",
"Could not find the desired feature" : "Fandt ikke den ønskede funktion",
"Invalid Host" : "Ugyldig vært",
"Server" : "Server",
diff --git a/apps/user_ldap/l10n/da.json b/apps/user_ldap/l10n/da.json
index 97d0c0ca403..0332afc101d 100644
--- a/apps/user_ldap/l10n/da.json
+++ b/apps/user_ldap/l10n/da.json
@@ -31,6 +31,7 @@
"Confirm Deletion" : "Bekræft Sletning",
"_%s group found_::_%s groups found_" : ["Der blev fundet %s gruppe","Der blev fundet %s grupper"],
"_%s user found_::_%s users found_" : ["Der blev fundet %s bruger","Der blev fundet %s brugere"],
+ "Could not detect user display name attribute. Please specify it yourself in advanced ldap settings." : "Kunne ikke registrere navneattributten for visning af bruger. Angiv den venligst selv i de avancerede ldap-indstillinger.",
"Could not find the desired feature" : "Fandt ikke den ønskede funktion",
"Invalid Host" : "Ugyldig vært",
"Server" : "Server",
diff --git a/apps/user_ldap/l10n/de.js b/apps/user_ldap/l10n/de.js
index 94f388b0df4..545fb9c194f 100644
--- a/apps/user_ldap/l10n/de.js
+++ b/apps/user_ldap/l10n/de.js
@@ -33,6 +33,7 @@ OC.L10N.register(
"Confirm Deletion" : "Löschung bestätigen",
"_%s group found_::_%s groups found_" : ["%s Gruppe gefunden","%s Gruppen gefunden"],
"_%s user found_::_%s users found_" : ["%s Benutzer gefunden","%s Benutzer gefunden"],
+ "Could not detect user display name attribute. Please specify it yourself in advanced ldap settings." : "Das Benutzeranzeigename-Attribut konnte nicht gefunden werden. Bitte gib es selber in den erweiterten LDAP-Einstellungen an.",
"Could not find the desired feature" : "Konnte die gewünschte Funktion nicht finden",
"Invalid Host" : "Ungültiger Host",
"Server" : "Server",
diff --git a/apps/user_ldap/l10n/de.json b/apps/user_ldap/l10n/de.json
index f3524664fc1..df0f777536a 100644
--- a/apps/user_ldap/l10n/de.json
+++ b/apps/user_ldap/l10n/de.json
@@ -31,6 +31,7 @@
"Confirm Deletion" : "Löschung bestätigen",
"_%s group found_::_%s groups found_" : ["%s Gruppe gefunden","%s Gruppen gefunden"],
"_%s user found_::_%s users found_" : ["%s Benutzer gefunden","%s Benutzer gefunden"],
+ "Could not detect user display name attribute. Please specify it yourself in advanced ldap settings." : "Das Benutzeranzeigename-Attribut konnte nicht gefunden werden. Bitte gib es selber in den erweiterten LDAP-Einstellungen an.",
"Could not find the desired feature" : "Konnte die gewünschte Funktion nicht finden",
"Invalid Host" : "Ungültiger Host",
"Server" : "Server",
diff --git a/apps/user_ldap/l10n/de_DE.js b/apps/user_ldap/l10n/de_DE.js
index 3cefc2ec625..c89d7793a4a 100644
--- a/apps/user_ldap/l10n/de_DE.js
+++ b/apps/user_ldap/l10n/de_DE.js
@@ -33,6 +33,7 @@ OC.L10N.register(
"Confirm Deletion" : "Löschung bestätigen",
"_%s group found_::_%s groups found_" : ["%s Gruppe gefunden","%s Gruppen gefunden"],
"_%s user found_::_%s users found_" : ["%s Benutzer gefunden","%s Benutzer gefunden"],
+ "Could not detect user display name attribute. Please specify it yourself in advanced ldap settings." : "Das Benutzeranzeigename-Attribut konnte nicht gefunden werden. Bitte geben Sie es selber in den erweiterten LDAP-Einstellungen an.",
"Could not find the desired feature" : "Konnte die gewünschte Funktion nicht finden",
"Invalid Host" : "Ungültiger Host",
"Server" : "Server",
diff --git a/apps/user_ldap/l10n/de_DE.json b/apps/user_ldap/l10n/de_DE.json
index cf823ca29d4..7b047cbcd2f 100644
--- a/apps/user_ldap/l10n/de_DE.json
+++ b/apps/user_ldap/l10n/de_DE.json
@@ -31,6 +31,7 @@
"Confirm Deletion" : "Löschung bestätigen",
"_%s group found_::_%s groups found_" : ["%s Gruppe gefunden","%s Gruppen gefunden"],
"_%s user found_::_%s users found_" : ["%s Benutzer gefunden","%s Benutzer gefunden"],
+ "Could not detect user display name attribute. Please specify it yourself in advanced ldap settings." : "Das Benutzeranzeigename-Attribut konnte nicht gefunden werden. Bitte geben Sie es selber in den erweiterten LDAP-Einstellungen an.",
"Could not find the desired feature" : "Konnte die gewünschte Funktion nicht finden",
"Invalid Host" : "Ungültiger Host",
"Server" : "Server",
diff --git a/apps/user_ldap/l10n/en_GB.js b/apps/user_ldap/l10n/en_GB.js
index d87ce836807..9476b44dde0 100644
--- a/apps/user_ldap/l10n/en_GB.js
+++ b/apps/user_ldap/l10n/en_GB.js
@@ -33,6 +33,7 @@ OC.L10N.register(
"Confirm Deletion" : "Confirm Deletion",
"_%s group found_::_%s groups found_" : ["%s group found","%s groups found"],
"_%s user found_::_%s users found_" : ["%s user found","%s users found"],
+ "Could not detect user display name attribute. Please specify it yourself in advanced ldap settings." : "Could not detect user display name attribute. Please specify it yourself in advanced ldap settings.",
"Could not find the desired feature" : "Could not find the desired feature",
"Invalid Host" : "Invalid Host",
"Server" : "Server",
diff --git a/apps/user_ldap/l10n/en_GB.json b/apps/user_ldap/l10n/en_GB.json
index 8fd6ed30d4f..fd6861a5184 100644
--- a/apps/user_ldap/l10n/en_GB.json
+++ b/apps/user_ldap/l10n/en_GB.json
@@ -31,6 +31,7 @@
"Confirm Deletion" : "Confirm Deletion",
"_%s group found_::_%s groups found_" : ["%s group found","%s groups found"],
"_%s user found_::_%s users found_" : ["%s user found","%s users found"],
+ "Could not detect user display name attribute. Please specify it yourself in advanced ldap settings." : "Could not detect user display name attribute. Please specify it yourself in advanced ldap settings.",
"Could not find the desired feature" : "Could not find the desired feature",
"Invalid Host" : "Invalid Host",
"Server" : "Server",
diff --git a/apps/user_ldap/l10n/fr.js b/apps/user_ldap/l10n/fr.js
index 3736ade73ce..3aeaaf0bb5c 100644
--- a/apps/user_ldap/l10n/fr.js
+++ b/apps/user_ldap/l10n/fr.js
@@ -33,6 +33,7 @@ OC.L10N.register(
"Confirm Deletion" : "Confirmer la suppression",
"_%s group found_::_%s groups found_" : ["%s groupe trouvé","%s groupes trouvés"],
"_%s user found_::_%s users found_" : ["%s utilisateur trouvé","%s utilisateurs trouvés"],
+ "Could not detect user display name attribute. Please specify it yourself in advanced ldap settings." : "Impossible de détecter l'attribut contenant le nom d'affichage des utilisateurs. Veuillez l'indiquer vous-même dans les paramètres ldap avancés.",
"Could not find the desired feature" : "Impossible de trouver la fonction souhaitée",
"Invalid Host" : "Hôte invalide",
"Server" : "Serveur",
@@ -96,13 +97,13 @@ OC.L10N.register(
"in seconds. A change empties the cache." : "en secondes. Tout changement vide le cache.",
"Directory Settings" : "Paramètres du répertoire",
"User Display Name Field" : "Champ \"nom d'affichage\" de l'utilisateur",
- "The LDAP attribute to use to generate the user's display name." : "L'attribut LDAP utilisé pour générer le nom d'utilisateur affiché.",
+ "The LDAP attribute to use to generate the user's display name." : "L'attribut LDAP utilisé pour générer le nom d'affichage de l'utilisateur.",
"Base User Tree" : "DN racine de l'arbre utilisateurs",
"One User Base DN per line" : "Un DN racine utilisateur par ligne",
"User Search Attributes" : "Recherche des attributs utilisateur",
"Optional; one attribute per line" : "Optionnel, un attribut par ligne",
"Group Display Name Field" : "Champ \"nom d'affichage\" du groupe",
- "The LDAP attribute to use to generate the groups's display name." : "L'attribut LDAP utilisé pour générer le nom de groupe affiché.",
+ "The LDAP attribute to use to generate the groups's display name." : "L'attribut LDAP utilisé pour générer le nom d'affichage du groupe.",
"Base Group Tree" : "DN racine de l'arbre groupes",
"One Group Base DN per line" : "Un DN racine groupe par ligne",
"Group Search Attributes" : "Recherche des attributs du groupe",
@@ -119,7 +120,7 @@ OC.L10N.register(
"User Home Folder Naming Rule" : "Convention de nommage du répertoire utilisateur",
"Leave empty for user name (default). Otherwise, specify an LDAP/AD attribute." : "Laisser vide ",
"Internal Username" : "Nom d'utilisateur interne",
- "By default the internal username will be created from the UUID attribute. It makes sure that the username is unique and characters do not need to be converted. The internal username has the restriction that only these characters are allowed: [ a-zA-Z0-9_.@- ]. Other characters are replaced with their ASCII correspondence or simply omitted. On collisions a number will be added/increased. The internal username is used to identify a user internally. It is also the default name for the user home folder. It is also a part of remote URLs, for instance for all *DAV services. With this setting, the default behavior can be overridden. To achieve a similar behavior as before ownCloud 5 enter the user display name attribute in the following field. Leave it empty for default behavior. Changes will have effect only on newly mapped (added) LDAP users." : "Par défaut le nom d'utilisateur interne sera créé à partir de l'attribut UUID. Ceci permet d'assurer que le nom d'utilisateur est unique et que les caractères ne nécessitent pas de conversion. Le nom d'utilisateur interne doit contenir uniquement les caractères suivants : [ a-zA-Z0-9_.@- ]. Les autres caractères sont remplacés par leur correspondance ASCII ou simplement omis. En cas de collision, un nombre est incrémenté/décrémenté. Le nom d'utilisateur interne est utilisé pour identifier l'utilisateur au sein du système. C'est aussi le nom par défaut du répertoire utilisateur dans ownCloud. C'est aussi le port d'URLs distants, par exemple pour tous les services *DAV. Le comportement par défaut peut être modifié à l'aide de ce paramètre. Pour obtenir un comportement similaire aux versions précédentes à ownCloud 5, saisir le nom d'utilisateur à afficher dans le champ suivant. Laissez à blanc pour le comportement par défaut. Les modifications prendront effet seulement pour les nouveaux (ajoutés) utilisateurs LDAP.",
+ "By default the internal username will be created from the UUID attribute. It makes sure that the username is unique and characters do not need to be converted. The internal username has the restriction that only these characters are allowed: [ a-zA-Z0-9_.@- ]. Other characters are replaced with their ASCII correspondence or simply omitted. On collisions a number will be added/increased. The internal username is used to identify a user internally. It is also the default name for the user home folder. It is also a part of remote URLs, for instance for all *DAV services. With this setting, the default behavior can be overridden. To achieve a similar behavior as before ownCloud 5 enter the user display name attribute in the following field. Leave it empty for default behavior. Changes will have effect only on newly mapped (added) LDAP users." : "Par défaut le nom d'utilisateur interne sera créé à partir de l'attribut UUID. Ceci permet d'assurer que le nom d'utilisateur est unique et que les caractères ne nécessitent pas de conversion. Le nom d'utilisateur interne doit contenir uniquement les caractères suivants : [ a-zA-Z0-9_.@- ]. Les autres caractères sont remplacés par leur correspondance ASCII ou simplement omis. En cas de collision, un nombre est ajouté/incrémenté. Le nom d'utilisateur interne est utilisé pour identifier l'utilisateur au sein du système. C'est aussi le nom par défaut du répertoire utilisateur dans ownCloud. Il fait aussi partie de certains URL de services, par exemple pour tous les services *DAV. Le comportement par défaut peut être modifié à l'aide de ce paramètre. Pour obtenir un comportement similaire aux versions précédentes à ownCloud 5, saisir le nom d'utilisateur à afficher dans le champ suivant. Laissez à blanc pour le comportement par défaut. Les modifications prendront effet seulement pour les nouveaux (ajoutés) utilisateurs LDAP.",
"Internal Username Attribute:" : "Nom d'utilisateur interne :",
"Override UUID detection" : "Surcharger la détection d'UUID",
"By default, the UUID attribute is automatically detected. The UUID attribute is used to doubtlessly identify LDAP users and groups. Also, the internal username will be created based on the UUID, if not specified otherwise above. You can override the setting and pass an attribute of your choice. You must make sure that the attribute of your choice can be fetched for both users and groups and it is unique. Leave it empty for default behavior. Changes will have effect only on newly mapped (added) LDAP users and groups." : "Par défaut, l'attribut UUID est automatiquement détecté. Cet attribut est utilisé pour identifier les utilisateurs et groupes de façon fiable. Un nom d'utilisateur interne basé sur l'UUID sera automatiquement créé, sauf s'il est spécifié autrement ci-dessus. Vous pouvez modifier ce comportement et définir l'attribut de votre choix. Vous devez alors vous assurer que l'attribut de votre choix peut être récupéré pour les utilisateurs ainsi que pour les groupes et qu'il soit unique. Laisser à blanc pour le comportement par défaut. Les modifications seront effectives uniquement pour les nouveaux (ajoutés) utilisateurs et groupes LDAP.",
diff --git a/apps/user_ldap/l10n/fr.json b/apps/user_ldap/l10n/fr.json
index 58ac6f3d248..31d56f28b40 100644
--- a/apps/user_ldap/l10n/fr.json
+++ b/apps/user_ldap/l10n/fr.json
@@ -31,6 +31,7 @@
"Confirm Deletion" : "Confirmer la suppression",
"_%s group found_::_%s groups found_" : ["%s groupe trouvé","%s groupes trouvés"],
"_%s user found_::_%s users found_" : ["%s utilisateur trouvé","%s utilisateurs trouvés"],
+ "Could not detect user display name attribute. Please specify it yourself in advanced ldap settings." : "Impossible de détecter l'attribut contenant le nom d'affichage des utilisateurs. Veuillez l'indiquer vous-même dans les paramètres ldap avancés.",
"Could not find the desired feature" : "Impossible de trouver la fonction souhaitée",
"Invalid Host" : "Hôte invalide",
"Server" : "Serveur",
@@ -94,13 +95,13 @@
"in seconds. A change empties the cache." : "en secondes. Tout changement vide le cache.",
"Directory Settings" : "Paramètres du répertoire",
"User Display Name Field" : "Champ \"nom d'affichage\" de l'utilisateur",
- "The LDAP attribute to use to generate the user's display name." : "L'attribut LDAP utilisé pour générer le nom d'utilisateur affiché.",
+ "The LDAP attribute to use to generate the user's display name." : "L'attribut LDAP utilisé pour générer le nom d'affichage de l'utilisateur.",
"Base User Tree" : "DN racine de l'arbre utilisateurs",
"One User Base DN per line" : "Un DN racine utilisateur par ligne",
"User Search Attributes" : "Recherche des attributs utilisateur",
"Optional; one attribute per line" : "Optionnel, un attribut par ligne",
"Group Display Name Field" : "Champ \"nom d'affichage\" du groupe",
- "The LDAP attribute to use to generate the groups's display name." : "L'attribut LDAP utilisé pour générer le nom de groupe affiché.",
+ "The LDAP attribute to use to generate the groups's display name." : "L'attribut LDAP utilisé pour générer le nom d'affichage du groupe.",
"Base Group Tree" : "DN racine de l'arbre groupes",
"One Group Base DN per line" : "Un DN racine groupe par ligne",
"Group Search Attributes" : "Recherche des attributs du groupe",
@@ -117,7 +118,7 @@
"User Home Folder Naming Rule" : "Convention de nommage du répertoire utilisateur",
"Leave empty for user name (default). Otherwise, specify an LDAP/AD attribute." : "Laisser vide ",
"Internal Username" : "Nom d'utilisateur interne",
- "By default the internal username will be created from the UUID attribute. It makes sure that the username is unique and characters do not need to be converted. The internal username has the restriction that only these characters are allowed: [ a-zA-Z0-9_.@- ]. Other characters are replaced with their ASCII correspondence or simply omitted. On collisions a number will be added/increased. The internal username is used to identify a user internally. It is also the default name for the user home folder. It is also a part of remote URLs, for instance for all *DAV services. With this setting, the default behavior can be overridden. To achieve a similar behavior as before ownCloud 5 enter the user display name attribute in the following field. Leave it empty for default behavior. Changes will have effect only on newly mapped (added) LDAP users." : "Par défaut le nom d'utilisateur interne sera créé à partir de l'attribut UUID. Ceci permet d'assurer que le nom d'utilisateur est unique et que les caractères ne nécessitent pas de conversion. Le nom d'utilisateur interne doit contenir uniquement les caractères suivants : [ a-zA-Z0-9_.@- ]. Les autres caractères sont remplacés par leur correspondance ASCII ou simplement omis. En cas de collision, un nombre est incrémenté/décrémenté. Le nom d'utilisateur interne est utilisé pour identifier l'utilisateur au sein du système. C'est aussi le nom par défaut du répertoire utilisateur dans ownCloud. C'est aussi le port d'URLs distants, par exemple pour tous les services *DAV. Le comportement par défaut peut être modifié à l'aide de ce paramètre. Pour obtenir un comportement similaire aux versions précédentes à ownCloud 5, saisir le nom d'utilisateur à afficher dans le champ suivant. Laissez à blanc pour le comportement par défaut. Les modifications prendront effet seulement pour les nouveaux (ajoutés) utilisateurs LDAP.",
+ "By default the internal username will be created from the UUID attribute. It makes sure that the username is unique and characters do not need to be converted. The internal username has the restriction that only these characters are allowed: [ a-zA-Z0-9_.@- ]. Other characters are replaced with their ASCII correspondence or simply omitted. On collisions a number will be added/increased. The internal username is used to identify a user internally. It is also the default name for the user home folder. It is also a part of remote URLs, for instance for all *DAV services. With this setting, the default behavior can be overridden. To achieve a similar behavior as before ownCloud 5 enter the user display name attribute in the following field. Leave it empty for default behavior. Changes will have effect only on newly mapped (added) LDAP users." : "Par défaut le nom d'utilisateur interne sera créé à partir de l'attribut UUID. Ceci permet d'assurer que le nom d'utilisateur est unique et que les caractères ne nécessitent pas de conversion. Le nom d'utilisateur interne doit contenir uniquement les caractères suivants : [ a-zA-Z0-9_.@- ]. Les autres caractères sont remplacés par leur correspondance ASCII ou simplement omis. En cas de collision, un nombre est ajouté/incrémenté. Le nom d'utilisateur interne est utilisé pour identifier l'utilisateur au sein du système. C'est aussi le nom par défaut du répertoire utilisateur dans ownCloud. Il fait aussi partie de certains URL de services, par exemple pour tous les services *DAV. Le comportement par défaut peut être modifié à l'aide de ce paramètre. Pour obtenir un comportement similaire aux versions précédentes à ownCloud 5, saisir le nom d'utilisateur à afficher dans le champ suivant. Laissez à blanc pour le comportement par défaut. Les modifications prendront effet seulement pour les nouveaux (ajoutés) utilisateurs LDAP.",
"Internal Username Attribute:" : "Nom d'utilisateur interne :",
"Override UUID detection" : "Surcharger la détection d'UUID",
"By default, the UUID attribute is automatically detected. The UUID attribute is used to doubtlessly identify LDAP users and groups. Also, the internal username will be created based on the UUID, if not specified otherwise above. You can override the setting and pass an attribute of your choice. You must make sure that the attribute of your choice can be fetched for both users and groups and it is unique. Leave it empty for default behavior. Changes will have effect only on newly mapped (added) LDAP users and groups." : "Par défaut, l'attribut UUID est automatiquement détecté. Cet attribut est utilisé pour identifier les utilisateurs et groupes de façon fiable. Un nom d'utilisateur interne basé sur l'UUID sera automatiquement créé, sauf s'il est spécifié autrement ci-dessus. Vous pouvez modifier ce comportement et définir l'attribut de votre choix. Vous devez alors vous assurer que l'attribut de votre choix peut être récupéré pour les utilisateurs ainsi que pour les groupes et qu'il soit unique. Laisser à blanc pour le comportement par défaut. Les modifications seront effectives uniquement pour les nouveaux (ajoutés) utilisateurs et groupes LDAP.",
diff --git a/apps/user_ldap/l10n/it.js b/apps/user_ldap/l10n/it.js
index d7a4e192ec6..30b9a39f0ea 100644
--- a/apps/user_ldap/l10n/it.js
+++ b/apps/user_ldap/l10n/it.js
@@ -33,6 +33,7 @@ OC.L10N.register(
"Confirm Deletion" : "Conferma l'eliminazione",
"_%s group found_::_%s groups found_" : ["%s gruppo trovato","%s gruppi trovati"],
"_%s user found_::_%s users found_" : ["%s utente trovato","%s utenti trovati"],
+ "Could not detect user display name attribute. Please specify it yourself in advanced ldap settings." : "Impossibile rilevare l'attributo nome visualizzato dell'utente. Specificalo nelle impostazioni avanzate di ldap.",
"Could not find the desired feature" : "Impossibile trovare la funzionalità desiderata",
"Invalid Host" : "Host non valido",
"Server" : "Server",
diff --git a/apps/user_ldap/l10n/it.json b/apps/user_ldap/l10n/it.json
index 44a529bc0c5..58b405730a4 100644
--- a/apps/user_ldap/l10n/it.json
+++ b/apps/user_ldap/l10n/it.json
@@ -31,6 +31,7 @@
"Confirm Deletion" : "Conferma l'eliminazione",
"_%s group found_::_%s groups found_" : ["%s gruppo trovato","%s gruppi trovati"],
"_%s user found_::_%s users found_" : ["%s utente trovato","%s utenti trovati"],
+ "Could not detect user display name attribute. Please specify it yourself in advanced ldap settings." : "Impossibile rilevare l'attributo nome visualizzato dell'utente. Specificalo nelle impostazioni avanzate di ldap.",
"Could not find the desired feature" : "Impossibile trovare la funzionalità desiderata",
"Invalid Host" : "Host non valido",
"Server" : "Server",
diff --git a/apps/user_ldap/l10n/nl.js b/apps/user_ldap/l10n/nl.js
index e448b161f00..ae280e1a05e 100644
--- a/apps/user_ldap/l10n/nl.js
+++ b/apps/user_ldap/l10n/nl.js
@@ -33,6 +33,7 @@ OC.L10N.register(
"Confirm Deletion" : "Bevestig verwijderen",
"_%s group found_::_%s groups found_" : ["%s groep gevonden","%s groepen gevonden"],
"_%s user found_::_%s users found_" : ["%s gebruiker gevonden","%s gebruikers gevonden"],
+ "Could not detect user display name attribute. Please specify it yourself in advanced ldap settings." : "Kon het weergavenaam attribuut van de gebruiker niet vinden. Geef het zelf op in de geavanceerde ldap instellingen.",
"Could not find the desired feature" : "Kon de gewenste functie niet vinden",
"Invalid Host" : "Ongeldige server",
"Server" : "Server",
diff --git a/apps/user_ldap/l10n/nl.json b/apps/user_ldap/l10n/nl.json
index eb1eecf8201..ed0ce08501a 100644
--- a/apps/user_ldap/l10n/nl.json
+++ b/apps/user_ldap/l10n/nl.json
@@ -31,6 +31,7 @@
"Confirm Deletion" : "Bevestig verwijderen",
"_%s group found_::_%s groups found_" : ["%s groep gevonden","%s groepen gevonden"],
"_%s user found_::_%s users found_" : ["%s gebruiker gevonden","%s gebruikers gevonden"],
+ "Could not detect user display name attribute. Please specify it yourself in advanced ldap settings." : "Kon het weergavenaam attribuut van de gebruiker niet vinden. Geef het zelf op in de geavanceerde ldap instellingen.",
"Could not find the desired feature" : "Kon de gewenste functie niet vinden",
"Invalid Host" : "Ongeldige server",
"Server" : "Server",
diff --git a/apps/user_ldap/l10n/pt_BR.js b/apps/user_ldap/l10n/pt_BR.js
index 32b7697df3e..a4a481524ba 100644
--- a/apps/user_ldap/l10n/pt_BR.js
+++ b/apps/user_ldap/l10n/pt_BR.js
@@ -33,6 +33,7 @@ OC.L10N.register(
"Confirm Deletion" : "Confirmar Exclusão",
"_%s group found_::_%s groups found_" : ["grupo% s encontrado","grupos% s encontrado"],
"_%s user found_::_%s users found_" : ["usuário %s encontrado","usuários %s encontrados"],
+ "Could not detect user display name attribute. Please specify it yourself in advanced ldap settings." : "Não foi possível detectar o nome de exibição do atributo do usuário. Por favor, indique-o você mesmo em configurações avançadas do LDAP.",
"Could not find the desired feature" : "Não foi possível encontrar a função desejada",
"Invalid Host" : "Host Inválido",
"Server" : "Servidor",
diff --git a/apps/user_ldap/l10n/pt_BR.json b/apps/user_ldap/l10n/pt_BR.json
index ea59ed7b4d8..4dd9088b727 100644
--- a/apps/user_ldap/l10n/pt_BR.json
+++ b/apps/user_ldap/l10n/pt_BR.json
@@ -31,6 +31,7 @@
"Confirm Deletion" : "Confirmar Exclusão",
"_%s group found_::_%s groups found_" : ["grupo% s encontrado","grupos% s encontrado"],
"_%s user found_::_%s users found_" : ["usuário %s encontrado","usuários %s encontrados"],
+ "Could not detect user display name attribute. Please specify it yourself in advanced ldap settings." : "Não foi possível detectar o nome de exibição do atributo do usuário. Por favor, indique-o você mesmo em configurações avançadas do LDAP.",
"Could not find the desired feature" : "Não foi possível encontrar a função desejada",
"Invalid Host" : "Host Inválido",
"Server" : "Servidor",
diff --git a/apps/user_ldap/l10n/tr.js b/apps/user_ldap/l10n/tr.js
index 75f3678fdd9..a4c308e5354 100644
--- a/apps/user_ldap/l10n/tr.js
+++ b/apps/user_ldap/l10n/tr.js
@@ -33,6 +33,7 @@ OC.L10N.register(
"Confirm Deletion" : "Silmeyi onayla",
"_%s group found_::_%s groups found_" : ["%s grup bulundu","%s grup bulundu"],
"_%s user found_::_%s users found_" : ["%s kullanıcı bulundu","%s kullanıcı bulundu"],
+ "Could not detect user display name attribute. Please specify it yourself in advanced ldap settings." : "Görüntülenecek kullanıcı adı özelliği algılanamadı. Lütfen gelişmiş ldap ayarlarına girerek kendiniz belirleyin.",
"Could not find the desired feature" : "İstenen özellik bulunamadı",
"Invalid Host" : "Geçersiz Makine",
"Server" : "Sunucu",
diff --git a/apps/user_ldap/l10n/tr.json b/apps/user_ldap/l10n/tr.json
index 9b6f3a37ade..dbd4a9b7406 100644
--- a/apps/user_ldap/l10n/tr.json
+++ b/apps/user_ldap/l10n/tr.json
@@ -31,6 +31,7 @@
"Confirm Deletion" : "Silmeyi onayla",
"_%s group found_::_%s groups found_" : ["%s grup bulundu","%s grup bulundu"],
"_%s user found_::_%s users found_" : ["%s kullanıcı bulundu","%s kullanıcı bulundu"],
+ "Could not detect user display name attribute. Please specify it yourself in advanced ldap settings." : "Görüntülenecek kullanıcı adı özelliği algılanamadı. Lütfen gelişmiş ldap ayarlarına girerek kendiniz belirleyin.",
"Could not find the desired feature" : "İstenen özellik bulunamadı",
"Invalid Host" : "Geçersiz Makine",
"Server" : "Sunucu",
diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php
index d89029abf17..6f28a87d30c 100644
--- a/apps/user_ldap/lib/access.php
+++ b/apps/user_ldap/lib/access.php
@@ -813,7 +813,7 @@ class Access extends LDAPUtility implements user\IUserTools {
}
//check whether paged search should be attempted
- $pagedSearchOK = $this->initPagedSearch($filter, $base, $attr, $limit, $offset);
+ $pagedSearchOK = $this->initPagedSearch($filter, $base, $attr, intval($limit), $offset);
$linkResources = array_pad(array(), count($base), $cr);
$sr = $this->ldap->search($linkResources, $base, $filter, $attr);
@@ -887,8 +887,9 @@ class Access extends LDAPUtility implements user\IUserTools {
private function count($filter, $base, $attr = null, $limit = null, $offset = null, $skipHandling = false) {
\OCP\Util::writeLog('user_ldap', 'Count filter: '.print_r($filter, true), \OCP\Util::DEBUG);
- if(is_null($limit) || $limit <= 0) {
- $limit = intval($this->connection->ldapPagingSize);
+ $limitPerPage = intval($this->connection->ldapPagingSize);
+ if(!is_null($limit) && $limit < $limitPerPage && $limit > 0) {
+ $limitPerPage = $limit;
}
$counter = 0;
@@ -898,19 +899,19 @@ class Access extends LDAPUtility implements user\IUserTools {
do {
$continue = false;
$search = $this->executeSearch($filter, $base, $attr,
- $limit, $offset);
+ $limitPerPage, $offset);
if($search === false) {
return $counter > 0 ? $counter : false;
}
list($sr, $pagedSearchOK) = $search;
- $count = $this->countEntriesInSearchResults($sr, $limit, $continue);
+ $count = $this->countEntriesInSearchResults($sr, $limitPerPage, $continue);
$counter += $count;
- $this->processPagedSearchStatus($sr, $filter, $base, $count, $limit,
+ $this->processPagedSearchStatus($sr, $filter, $base, $count, $limitPerPage,
$offset, $pagedSearchOK, $skipHandling);
- $offset += $limit;
- } while($continue);
+ $offset += $limitPerPage;
+ } while($continue && (is_null($limit) || $limit <= 0 || $limit > $counter));
return $counter;
}
@@ -1168,6 +1169,19 @@ class Access extends LDAPUtility implements user\IUserTools {
}
/**
+ * returns the filter used for counting users
+ * @return string
+ */
+ public function getFilterForUserCount() {
+ $filter = $this->combineFilterWithAnd(array(
+ $this->connection->ldapUserFilter,
+ $this->connection->ldapUserDisplayName . '=*'
+ ));
+
+ return $filter;
+ }
+
+ /**
* @param string $name
* @param string $password
* @return bool
@@ -1457,7 +1471,7 @@ class Access extends LDAPUtility implements user\IUserTools {
*/
private function initPagedSearch($filter, $bases, $attr, $limit, $offset) {
$pagedSearchOK = false;
- if($this->connection->hasPagedResultSupport && !is_null($limit)) {
+ if($this->connection->hasPagedResultSupport && ($limit !== 0)) {
$offset = intval($offset); //can be null
\OCP\Util::writeLog('user_ldap',
'initializing paged search for Filter '.$filter.' base '.print_r($bases, true)
diff --git a/apps/user_ldap/lib/wizard.php b/apps/user_ldap/lib/wizard.php
index 1d7701440e9..578a920f00e 100644
--- a/apps/user_ldap/lib/wizard.php
+++ b/apps/user_ldap/lib/wizard.php
@@ -56,7 +56,7 @@ class Wizard extends LDAPUtility {
Wizard::$l = \OC::$server->getL10N('user_ldap');
}
$this->access = $access;
- $this->result = new WizardResult;
+ $this->result = new WizardResult();
}
public function __destruct() {
@@ -120,7 +120,7 @@ class Wizard extends LDAPUtility {
* @throws \Exception
*/
public function countUsers() {
- $filter = $this->configuration->ldapUserFilter;
+ $filter = $this->access->getFilterForUserCount();
$usersTotal = $this->countEntries($filter, 'users');
$usersTotal = ($usersTotal !== false) ? $usersTotal : 0;
@@ -132,9 +132,10 @@ class Wizard extends LDAPUtility {
/**
* counts users with a specified attribute
* @param string $attr
+ * @param bool $existsCheck
* @return int|bool
*/
- public function countUsersWithAttribute($attr) {
+ public function countUsersWithAttribute($attr, $existsCheck = false) {
if(!$this->checkRequirements(array('ldapHost',
'ldapPort',
'ldapBase',
@@ -148,7 +149,51 @@ class Wizard extends LDAPUtility {
$attr . '=*'
));
- return $this->access->countUsers($filter);
+ $limit = ($existsCheck === false) ? null : 1;
+
+ return $this->access->countUsers($filter, array('dn'), $limit);
+ }
+
+ /**
+ * detects the display name attribute. If a setting is already present that
+ * returns at least one hit, the detection will be canceled.
+ * @return WizardResult|bool
+ * @throws \Exception
+ */
+ public function detectUserDisplayNameAttribute() {
+ if(!$this->checkRequirements(array('ldapHost',
+ 'ldapPort',
+ 'ldapBase',
+ 'ldapUserFilter',
+ ))) {
+ return false;
+ }
+
+ $attr = $this->configuration->ldapUserDisplayName;
+ if($attr !== 'displayName' && !empty($attr)) {
+ // most likely not the default value with upper case N,
+ // verify it still produces a result
+ $count = intval($this->countUsersWithAttribute($attr, true));
+ if($count > 0) {
+ //no change, but we sent it back to make sure the user interface
+ //is still correct, even if the ajax call was cancelled inbetween
+ $this->result->addChange('ldap_display_name', $attr);
+ return $this->result;
+ }
+ }
+
+ // first attribute that has at least one result wins
+ $displayNameAttrs = array('displayname', 'cn');
+ foreach ($displayNameAttrs as $attr) {
+ $count = intval($this->countUsersWithAttribute($attr, true));
+
+ if($count > 0) {
+ $this->applyFind('ldap_display_name', $attr);
+ return $this->result;
+ }
+ };
+
+ throw new \Exception(self::$l->t('Could not detect user display name attribute. Please specify it yourself in advanced ldap settings.'));
}
/**
@@ -168,7 +213,7 @@ class Wizard extends LDAPUtility {
$attr = $this->configuration->ldapEmailAttribute;
if(!empty($attr)) {
- $count = intval($this->countUsersWithAttribute($attr));
+ $count = intval($this->countUsersWithAttribute($attr, true));
if($count > 0) {
return false;
}
@@ -189,7 +234,7 @@ class Wizard extends LDAPUtility {
}
if($winner !== '') {
- $this->result->addChange('ldap_email_attr', $winner);
+ $this->applyFind('ldap_email_attr', $winner);
if($writeLog) {
\OCP\Util::writeLog('user_ldap', 'The mail attribute has ' .
'automatically been reset, because the original value ' .
diff --git a/apps/user_ldap/tests/user_ldap.php b/apps/user_ldap/tests/user_ldap.php
index e91404d47f2..33cec0247b6 100644
--- a/apps/user_ldap/tests/user_ldap.php
+++ b/apps/user_ldap/tests/user_ldap.php
@@ -552,23 +552,9 @@ class Test_User_Ldap_Direct extends \Test\TestCase {
public function testCountUsers() {
$access = $this->getAccessMock();
- $access->connection->expects($this->once())
- ->method('__get')
- ->will($this->returnCallback(function($name) {
- if($name === 'ldapLoginFilter') {
- return 'uid=%uid';
- }
- return null;
- }));
-
$access->expects($this->once())
->method('countUsers')
- ->will($this->returnCallback(function($filter, $a, $b, $c) {
- if($filter !== 'uid=*') {
- return false;
- }
- return 5;
- }));
+ ->will($this->returnValue(5));
$backend = new UserLDAP($access);
@@ -579,23 +565,9 @@ class Test_User_Ldap_Direct extends \Test\TestCase {
public function testCountUsersFailing() {
$access = $this->getAccessMock();
- $access->connection->expects($this->once())
- ->method('__get')
- ->will($this->returnCallback(function($name) {
- if($name === 'ldapLoginFilter') {
- return 'invalidFilter';
- }
- return null;
- }));
-
$access->expects($this->once())
->method('countUsers')
- ->will($this->returnCallback(function($filter, $a, $b, $c) {
- if($filter !== 'uid=*') {
- return false;
- }
- return 5;
- }));
+ ->will($this->returnValue(false));
$backend = new UserLDAP($access);
diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php
index 6e244311d4a..c2f87ebeb22 100644
--- a/apps/user_ldap/user_ldap.php
+++ b/apps/user_ldap/user_ldap.php
@@ -290,8 +290,7 @@ class USER_LDAP extends BackendUtility implements \OCP\UserInterface {
* @return int|bool
*/
public function countUsers() {
- $filter = \OCP\Util::mb_str_replace(
- '%uid', '*', $this->access->connection->ldapLoginFilter, 'UTF-8');
+ $filter = $this->access->getFilterForUserCount();
$entries = $this->access->countUsers($filter);
return $entries;
}
diff --git a/config/config.sample.php b/config/config.sample.php
index 2287b7af7dd..26cc356fd04 100644
--- a/config/config.sample.php
+++ b/config/config.sample.php
@@ -77,7 +77,8 @@ $CONFIG = array(
/**
* Where user files are stored; this defaults to ``data/`` in the ownCloud
- * directory. The SQLite database is also stored here, when you use SQLite.
+ * directory. The SQLite database is also stored here, when you use SQLite. (SQLite is
+ * available only in ownCloud Community Edition)
*/
'datadirectory' => '/var/www/owncloud/data',
@@ -134,6 +135,12 @@ $CONFIG = array(
),
/**
+ * sqlite3 journal mode can be specified using this config parameter - can be 'WAL' or 'DELETE'
+ * see for more details https://www.sqlite.org/wal.html
+ */
+'sqlite.journal_mode' => 'DELETE',
+
+/**
* Indicates whether the ownCloud instance was installed successfully; ``true``
* indicates a successful installation, and ``false`` indicates an unsuccessful
* installation.
@@ -527,6 +534,7 @@ $CONFIG = array(
/**
* When enabled, admins may install apps from the ownCloud app store.
+ * The app store is disabled by default for ownCloud Enterprise Edition
*/
'appstoreenabled' => true,
@@ -617,7 +625,7 @@ $CONFIG = array(
* concerns:
*
* - OC\Preview\Illustrator
- * - OC\Preview\Movies
+ * - OC\Preview\Movie
* - OC\Preview\MSOffice2003
* - OC\Preview\MSOffice2007
* - OC\Preview\MSOfficeDoc
@@ -822,7 +830,8 @@ $CONFIG = array(
),
/**
- * Database types that are supported for installation.
+ * Database types that are supported for installation. (SQLite is available only in
+ * ownCloud Community Edition, oci and mssql only for the Enterprise Edition)
*
* Available:
* - sqlite (SQLite3)
diff --git a/core/l10n/ca.js b/core/l10n/ca.js
index ee837ea7b7f..edec2f989f6 100644
--- a/core/l10n/ca.js
+++ b/core/l10n/ca.js
@@ -184,7 +184,7 @@ OC.L10N.register(
"This means only administrators can use the instance." : "Això significa que només els administradors poden usar la instància.",
"Contact your system administrator if this message persists or appeared unexpectedly." : "Contacteu amb l'administrador del sistema si aquest missatge persisteix o apareix inesperadament.",
"Thank you for your patience." : "Gràcies per la paciència.",
- "You are accessing the server from an untrusted domain." : "Esteu accedint el servidor des d'un domini no fiable",
+ "You are accessing the server from an untrusted domain." : "Esteu accedint al servidor des d'un domini no fiable",
"Please contact your administrator. If you are an administrator of this instance, configure the \"trusted_domain\" setting in config/config.php. An example configuration is provided in config/config.sample.php." : "Contacteu amb l'administrador. Si sou un administrador d'aquesta instància, configureu el paràmetre \"trusted_domain\" a config/config.php. Hi ha un exemple de configuració a config/config.sampe.php",
"Depending on your configuration, as an administrator you might also be able to use the button below to trust this domain." : "En funció de la teva configuració, com a administrador podries utilitzar el botó d'abaix per confiar en aquest domini.",
"Add \"%s\" as trusted domain" : "Afegeix \"%s\" com a domini de confiança",
diff --git a/core/l10n/ca.json b/core/l10n/ca.json
index 374e9a51440..fea3cdefec2 100644
--- a/core/l10n/ca.json
+++ b/core/l10n/ca.json
@@ -182,7 +182,7 @@
"This means only administrators can use the instance." : "Això significa que només els administradors poden usar la instància.",
"Contact your system administrator if this message persists or appeared unexpectedly." : "Contacteu amb l'administrador del sistema si aquest missatge persisteix o apareix inesperadament.",
"Thank you for your patience." : "Gràcies per la paciència.",
- "You are accessing the server from an untrusted domain." : "Esteu accedint el servidor des d'un domini no fiable",
+ "You are accessing the server from an untrusted domain." : "Esteu accedint al servidor des d'un domini no fiable",
"Please contact your administrator. If you are an administrator of this instance, configure the \"trusted_domain\" setting in config/config.php. An example configuration is provided in config/config.sample.php." : "Contacteu amb l'administrador. Si sou un administrador d'aquesta instància, configureu el paràmetre \"trusted_domain\" a config/config.php. Hi ha un exemple de configuració a config/config.sampe.php",
"Depending on your configuration, as an administrator you might also be able to use the button below to trust this domain." : "En funció de la teva configuració, com a administrador podries utilitzar el botó d'abaix per confiar en aquest domini.",
"Add \"%s\" as trusted domain" : "Afegeix \"%s\" com a domini de confiança",
diff --git a/core/l10n/da.js b/core/l10n/da.js
index a1222792fc5..ea228ee8b81 100644
--- a/core/l10n/da.js
+++ b/core/l10n/da.js
@@ -106,9 +106,9 @@ OC.L10N.register(
"Enter new" : "Indtast nyt",
"Delete" : "Slet",
"Add" : "Tilføj",
- "Edit tags" : "Rediger tags",
+ "Edit tags" : "Redigér mærker",
"Error loading dialog template: {error}" : "Fejl ved indlæsning dialog skabelon: {error}",
- "No tags selected for deletion." : "Ingen tags markeret til sletning.",
+ "No tags selected for deletion." : "Ingen mærker markeret til sletning.",
"unknown text" : "ukendt tekst",
"Hello world!" : "Hej verden!",
"sunny" : "solrigt",
@@ -133,11 +133,11 @@ OC.L10N.register(
"Apps" : "Apps",
"Admin" : "Admin",
"Help" : "Hjælp",
- "Error loading tags" : "Fejl ved indlæsning af tags",
- "Tag already exists" : "Tag eksistere allerede",
- "Error deleting tag(s)" : "Fejl ved sletning af tag(s)",
- "Error tagging" : "Fejl ved tagging",
- "Error untagging" : "Fejl ved fjernelse af tag",
+ "Error loading tags" : "Fejl ved indlæsning af mærker",
+ "Tag already exists" : "Mærket eksisterer allerede",
+ "Error deleting tag(s)" : "Fejl ved sletning af mærke(r)",
+ "Error tagging" : "Fejl ved opmærkning",
+ "Error untagging" : "Fejl ved fjernelse af opmærkning",
"Error favoriting" : "Fejl ved favoritering",
"Error unfavoriting" : "Fejl ved fjernelse af favorisering.",
"Access forbidden" : "Adgang forbudt",
diff --git a/core/l10n/da.json b/core/l10n/da.json
index 5111e5d3e05..021d43e8c7b 100644
--- a/core/l10n/da.json
+++ b/core/l10n/da.json
@@ -104,9 +104,9 @@
"Enter new" : "Indtast nyt",
"Delete" : "Slet",
"Add" : "Tilføj",
- "Edit tags" : "Rediger tags",
+ "Edit tags" : "Redigér mærker",
"Error loading dialog template: {error}" : "Fejl ved indlæsning dialog skabelon: {error}",
- "No tags selected for deletion." : "Ingen tags markeret til sletning.",
+ "No tags selected for deletion." : "Ingen mærker markeret til sletning.",
"unknown text" : "ukendt tekst",
"Hello world!" : "Hej verden!",
"sunny" : "solrigt",
@@ -131,11 +131,11 @@
"Apps" : "Apps",
"Admin" : "Admin",
"Help" : "Hjælp",
- "Error loading tags" : "Fejl ved indlæsning af tags",
- "Tag already exists" : "Tag eksistere allerede",
- "Error deleting tag(s)" : "Fejl ved sletning af tag(s)",
- "Error tagging" : "Fejl ved tagging",
- "Error untagging" : "Fejl ved fjernelse af tag",
+ "Error loading tags" : "Fejl ved indlæsning af mærker",
+ "Tag already exists" : "Mærket eksisterer allerede",
+ "Error deleting tag(s)" : "Fejl ved sletning af mærke(r)",
+ "Error tagging" : "Fejl ved opmærkning",
+ "Error untagging" : "Fejl ved fjernelse af opmærkning",
"Error favoriting" : "Fejl ved favoritering",
"Error unfavoriting" : "Fejl ved fjernelse af favorisering.",
"Access forbidden" : "Adgang forbudt",
diff --git a/core/l10n/fr.js b/core/l10n/fr.js
index 87e8b017832..0155b0c90c4 100644
--- a/core/l10n/fr.js
+++ b/core/l10n/fr.js
@@ -62,7 +62,7 @@ OC.L10N.register(
"So-so password" : "Mot de passe tout juste acceptable",
"Good password" : "Mot de passe de sécurité suffisante",
"Strong password" : "Mot de passe fort",
- "Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." : "Votre serveur web n'est pas correctement configuré pour permettre la synchronisation des fichiers, car l'interface WebDav semble ne pas fonctionner.",
+ "Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." : "Votre serveur web n'est pas correctement configuré pour permettre la synchronisation des fichiers car l'interface WebDav semble ne pas fonctionner.",
"This server has no working internet connection. This means that some of the features like mounting of external storage, notifications about updates or installation of 3rd party apps don´t work. Accessing files from remote and sending of notification emails might also not work. We suggest to enable internet connection for this server if you want to have all features." : "Ce serveur ne peut se connecter à internet. Cela signifie que certaines fonctionnalités, telles que le montage de supports de stockage distants, les notifications de mises à jour ou l'installation d'applications tierces ne fonctionneront pas. L'accès aux fichiers à distance, ainsi que les notifications par courriel ne fonctionneront pas non plus. Il est recommandé d'activer la connexion internet pour ce serveur si vous souhaitez disposer de l'ensemble des fonctionnalités offertes.",
"Error occurred while checking server setup" : "Une erreur s'est produite lors de la vérification de la configuration du serveur",
"Shared" : "Partagé",
diff --git a/core/l10n/fr.json b/core/l10n/fr.json
index 5b57d86f532..2ddd7d91a39 100644
--- a/core/l10n/fr.json
+++ b/core/l10n/fr.json
@@ -60,7 +60,7 @@
"So-so password" : "Mot de passe tout juste acceptable",
"Good password" : "Mot de passe de sécurité suffisante",
"Strong password" : "Mot de passe fort",
- "Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." : "Votre serveur web n'est pas correctement configuré pour permettre la synchronisation des fichiers, car l'interface WebDav semble ne pas fonctionner.",
+ "Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." : "Votre serveur web n'est pas correctement configuré pour permettre la synchronisation des fichiers car l'interface WebDav semble ne pas fonctionner.",
"This server has no working internet connection. This means that some of the features like mounting of external storage, notifications about updates or installation of 3rd party apps don´t work. Accessing files from remote and sending of notification emails might also not work. We suggest to enable internet connection for this server if you want to have all features." : "Ce serveur ne peut se connecter à internet. Cela signifie que certaines fonctionnalités, telles que le montage de supports de stockage distants, les notifications de mises à jour ou l'installation d'applications tierces ne fonctionneront pas. L'accès aux fichiers à distance, ainsi que les notifications par courriel ne fonctionneront pas non plus. Il est recommandé d'activer la connexion internet pour ce serveur si vous souhaitez disposer de l'ensemble des fonctionnalités offertes.",
"Error occurred while checking server setup" : "Une erreur s'est produite lors de la vérification de la configuration du serveur",
"Shared" : "Partagé",
diff --git a/core/setup/controller.php b/core/setup/controller.php
index 39272120106..5a52b18f73b 100644
--- a/core/setup/controller.php
+++ b/core/setup/controller.php
@@ -12,13 +12,21 @@ namespace OC\Core\Setup;
use OCP\IConfig;
class Controller {
- /** @var \OCP\IConfig */
+ /**
+ * @var \OCP\IConfig
+ */
protected $config;
/**
+ * @var string
+ */
+ private $autoConfigFile;
+
+ /**
* @param IConfig $config
*/
function __construct(IConfig $config) {
+ $this->autoConfigFile = \OC::$SERVERROOT.'/config/autoconfig.php';
$this->config = $config;
}
@@ -64,15 +72,17 @@ class Controller {
}
public function finishSetup() {
+ if( file_exists( $this->autoConfigFile )) {
+ unlink($this->autoConfigFile);
+ }
\OC_Util::redirectToDefaultPage();
}
public function loadAutoConfig($post) {
- $autosetup_file = \OC::$SERVERROOT.'/config/autoconfig.php';
- if( file_exists( $autosetup_file )) {
+ if( file_exists($this->autoConfigFile)) {
\OC_Log::write('core', 'Autoconfig file found, setting up owncloud...', \OC_Log::INFO);
$AUTOCONFIG = array();
- include $autosetup_file;
+ include $this->autoConfigFile;
$post = array_merge ($post, $AUTOCONFIG);
}
@@ -82,9 +92,6 @@ class Controller {
if ($dbIsSet AND $directoryIsSet AND $adminAccountIsSet) {
$post['install'] = 'true';
- if( file_exists( $autosetup_file )) {
- unlink($autosetup_file);
- }
}
$post['dbIsSet'] = $dbIsSet;
$post['directoryIsSet'] = $directoryIsSet;
diff --git a/lib/base.php b/lib/base.php
index 82c0c7aa6d0..cd5d8feb1f6 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -66,17 +66,11 @@ class OC {
public static $REQUESTEDAPP = '';
/**
- * check if owncloud runs in cli mode
+ * check if ownCloud runs in cli mode
*/
public static $CLI = false;
/**
- * @deprecated use \OC::$server->getSession() instead
- * @var \OC\Session\Session
- */
- public static $session = null;
-
- /**
* @var \OC\Autoloader $loader
*/
public static $loader = null;
@@ -472,7 +466,7 @@ class OC {
}
// setup the basic server
- self::$server = new \OC\Server();
+ self::$server = new \OC\Server(\OC::$WEBROOT);
\OC::$server->getEventLogger()->log('autoloader', 'Autoloader', $loaderStart, $loaderEnd);
\OC::$server->getEventLogger()->start('boot', 'Initialize');
@@ -531,9 +525,7 @@ class OC {
\OC::$server->getEventLogger()->start('init_session', 'Initialize session');
OC_App::loadApps(array('session'));
- if (self::$CLI) {
- self::$session = new \OC\Session\Memory('');
- } else {
+ if (!self::$CLI) {
self::initSession();
}
\OC::$server->getEventLogger()->end('init_session');
diff --git a/lib/l10n/ca.js b/lib/l10n/ca.js
index d416b93503a..3137785d39f 100644
--- a/lib/l10n/ca.js
+++ b/lib/l10n/ca.js
@@ -12,6 +12,7 @@ OC.L10N.register(
"Settings" : "Configuració",
"Users" : "Usuaris",
"Admin" : "Administració",
+ "Recommended" : "Recomanat",
"App \\\"%s\\\" can't be installed because it is not compatible with this version of ownCloud." : "L'aplicació \\\"%s\\\" no es pot instal·lar perquè no es compatible amb aquesta versió de ownCloud.",
"No app name specified" : "No heu especificat cap nom d'aplicació",
"Unknown filetype" : "Tipus de fitxer desconegut",
diff --git a/lib/l10n/ca.json b/lib/l10n/ca.json
index 2698ed1846f..5efd4f5dad7 100644
--- a/lib/l10n/ca.json
+++ b/lib/l10n/ca.json
@@ -10,6 +10,7 @@
"Settings" : "Configuració",
"Users" : "Usuaris",
"Admin" : "Administració",
+ "Recommended" : "Recomanat",
"App \\\"%s\\\" can't be installed because it is not compatible with this version of ownCloud." : "L'aplicació \\\"%s\\\" no es pot instal·lar perquè no es compatible amb aquesta versió de ownCloud.",
"No app name specified" : "No heu especificat cap nom d'aplicació",
"Unknown filetype" : "Tipus de fitxer desconegut",
diff --git a/lib/l10n/da.js b/lib/l10n/da.js
index af85c3e93d1..09422654c6d 100644
--- a/lib/l10n/da.js
+++ b/lib/l10n/da.js
@@ -30,7 +30,7 @@ OC.L10N.register(
"App does not provide an info.xml file" : "Der følger ingen info.xml-fil med appen",
"App can't be installed because of not allowed code in the App" : "Appen kan ikke installeres, da den indeholder ikke-tilladt kode",
"App can't be installed because it is not compatible with this version of ownCloud" : "Appen kan ikke installeres, da den ikke er kompatibel med denne version af ownCloud.",
- "App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" : "Appen kan ikke installeres, da den indeholder taget\n<shipped>\n\ntrue\n</shipped>\n\nhvilket ikke er tilladt for ikke-medfølgende apps",
+ "App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" : "Appen kan ikke installeres, da den indeholder mærket <shipped>true</shipped>, hvilket ikke er tilladt for ikke-medfølgende apps",
"App can't be installed because the version in info.xml/version is not the same as the version reported from the app store" : "App kan ikke installeres, da versionen i info.xml/version ikke er den samme som versionen rapporteret fra app-storen",
"Application is not enabled" : "Programmet er ikke aktiveret",
"Authentication error" : "Adgangsfejl",
diff --git a/lib/l10n/da.json b/lib/l10n/da.json
index 59ff0e87b98..19a080fdf4a 100644
--- a/lib/l10n/da.json
+++ b/lib/l10n/da.json
@@ -28,7 +28,7 @@
"App does not provide an info.xml file" : "Der følger ingen info.xml-fil med appen",
"App can't be installed because of not allowed code in the App" : "Appen kan ikke installeres, da den indeholder ikke-tilladt kode",
"App can't be installed because it is not compatible with this version of ownCloud" : "Appen kan ikke installeres, da den ikke er kompatibel med denne version af ownCloud.",
- "App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" : "Appen kan ikke installeres, da den indeholder taget\n<shipped>\n\ntrue\n</shipped>\n\nhvilket ikke er tilladt for ikke-medfølgende apps",
+ "App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" : "Appen kan ikke installeres, da den indeholder mærket <shipped>true</shipped>, hvilket ikke er tilladt for ikke-medfølgende apps",
"App can't be installed because the version in info.xml/version is not the same as the version reported from the app store" : "App kan ikke installeres, da versionen i info.xml/version ikke er den samme som versionen rapporteret fra app-storen",
"Application is not enabled" : "Programmet er ikke aktiveret",
"Authentication error" : "Adgangsfejl",
diff --git a/lib/l10n/uk.js b/lib/l10n/uk.js
index 5afce6b2ced..4512cb25227 100644
--- a/lib/l10n/uk.js
+++ b/lib/l10n/uk.js
@@ -17,6 +17,8 @@ OC.L10N.register(
"No app name specified" : "Не вказано ім'я додатку",
"Unknown filetype" : "Невідомий тип файлу",
"Invalid image" : "Невірне зображення",
+ "Database Error" : "Помилка бази даних",
+ "Please contact your system administrator." : "Будь ласка, зверніться до системного адміністратора.",
"web services under your control" : "підконтрольні Вам веб-сервіси",
"App directory already exists" : "Тека додатку вже існує",
"Can't create app folder. Please fix permissions. %s" : "Неможливо створити теку додатку. Будь ласка, виправте права доступу. %s",
@@ -77,6 +79,7 @@ OC.L10N.register(
"years ago" : "роки тому",
"A valid username must be provided" : "Потрібно задати вірне ім'я користувача",
"A valid password must be provided" : "Потрібно задати вірний пароль",
+ "The username is already being used" : "Ім'я користувача вже використовується",
"No database drivers (sqlite, mysql, or postgresql) installed." : "Не встановлено драйвер бази даних (sqlite, mysql, or postgresql).",
"Cannot write into \"config\" directory" : "Не можу писати у теку \"config\"",
"Cannot write into \"apps\" directory" : "Не можу писати у теку \"apps\"",
diff --git a/lib/l10n/uk.json b/lib/l10n/uk.json
index 9c632437ac2..87f34e15657 100644
--- a/lib/l10n/uk.json
+++ b/lib/l10n/uk.json
@@ -15,6 +15,8 @@
"No app name specified" : "Не вказано ім'я додатку",
"Unknown filetype" : "Невідомий тип файлу",
"Invalid image" : "Невірне зображення",
+ "Database Error" : "Помилка бази даних",
+ "Please contact your system administrator." : "Будь ласка, зверніться до системного адміністратора.",
"web services under your control" : "підконтрольні Вам веб-сервіси",
"App directory already exists" : "Тека додатку вже існує",
"Can't create app folder. Please fix permissions. %s" : "Неможливо створити теку додатку. Будь ласка, виправте права доступу. %s",
@@ -75,6 +77,7 @@
"years ago" : "роки тому",
"A valid username must be provided" : "Потрібно задати вірне ім'я користувача",
"A valid password must be provided" : "Потрібно задати вірний пароль",
+ "The username is already being used" : "Ім'я користувача вже використовується",
"No database drivers (sqlite, mysql, or postgresql) installed." : "Не встановлено драйвер бази даних (sqlite, mysql, or postgresql).",
"Cannot write into \"config\" directory" : "Не можу писати у теку \"config\"",
"Cannot write into \"apps\" directory" : "Не можу писати у теку \"apps\"",
diff --git a/lib/private/activitymanager.php b/lib/private/activitymanager.php
index f31b121c8e8..e0ee7c1b055 100644
--- a/lib/private/activitymanager.php
+++ b/lib/private/activitymanager.php
@@ -247,16 +247,28 @@ class ActivityManager implements IManager {
* @return array
*/
function getQueryForFilter($filter) {
+
+ $conditions = array();
+ $parameters = array();
+
foreach($this->extensions as $extension) {
$c = $extension();
if ($c instanceof IExtension) {
$result = $c->getQueryForFilter($filter);
if (is_array($result)) {
- return $result;
+ list($condition, $parameter) = $result;
+ if ($condition && is_array($parameter)) {
+ $conditions[] = $condition;
+ $parameters = array_merge($parameters, $parameter);
+ }
}
}
}
- return array(null, null);
+ if (empty($conditions)) {
+ return array(null, null);
+ }
+
+ return array(' and ((' . implode(') or (', $conditions) . '))', $parameters);
}
}
diff --git a/lib/private/api.php b/lib/private/api.php
index f5576af2ad8..66b763fdc3e 100644
--- a/lib/private/api.php
+++ b/lib/private/api.php
@@ -132,7 +132,7 @@ class OC_API {
* @return array|\OC_OCS_Result
*/
public static function mergeResponses($responses) {
- // Sort into shipped and thirdparty
+ // Sort into shipped and third-party
$shipped = array(
'succeeded' => array(),
'failed' => array(),
@@ -162,7 +162,7 @@ class OC_API {
if(!empty($shipped['failed'])) {
// Which shipped response do we use if they all failed?
// They may have failed for different reasons (different status codes)
- // Which reponse code should we return?
+ // Which response code should we return?
// Maybe any that are not OC_API::RESPOND_SERVER_ERROR
// Merge failed responses if more than one
$data = array();
@@ -273,26 +273,32 @@ class OC_API {
// reuse existing login
$loggedIn = OC_User::isLoggedIn();
- $ocsApiRequest = isset($_SERVER['HTTP_OCS_APIREQUEST']) ? $_SERVER['HTTP_OCS_APIREQUEST'] === 'true' : false;
- if ($loggedIn === true && $ocsApiRequest) {
+ if ($loggedIn === true) {
+ $ocsApiRequest = isset($_SERVER['HTTP_OCS_APIREQUEST']) ? $_SERVER['HTTP_OCS_APIREQUEST'] === 'true' : false;
+ if ($ocsApiRequest) {
- // initialize the user's filesystem
- \OC_Util::setUpFS(\OC_User::getUser());
+ // initialize the user's filesystem
+ \OC_Util::setUpFS(\OC_User::getUser());
- return OC_User::getUser();
+ return OC_User::getUser();
+ }
+ return false;
}
- // basic auth
- $authUser = isset($_SERVER['PHP_AUTH_USER']) ? $_SERVER['PHP_AUTH_USER'] : '';
- $authPw = isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : '';
- $return = OC_User::login($authUser, $authPw);
- if ($return === true) {
- self::$logoutRequired = true;
+ // basic auth - because OC_User::login will create a new session we shall only try to login
+ // if user and pass are set
+ if(isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW']) ) {
+ $authUser = $_SERVER['PHP_AUTH_USER'];
+ $authPw = $_SERVER['PHP_AUTH_PW'];
+ $return = OC_User::login($authUser, $authPw);
+ if ($return === true) {
+ self::$logoutRequired = true;
- // initialize the user's filesystem
- \OC_Util::setUpFS(\OC_User::getUser());
+ // initialize the user's filesystem
+ \OC_Util::setUpFS(\OC_User::getUser());
- return $authUser;
+ return $authUser;
+ }
}
return false;
diff --git a/lib/private/app.php b/lib/private/app.php
index bc9ca0351ea..8e36d43bfb1 100644
--- a/lib/private/app.php
+++ b/lib/private/app.php
@@ -635,63 +635,10 @@ class OC_App {
}
$file = self::getAppPath($appId) . '/appinfo/info.xml';
}
- $data = array();
- if (!file_exists($file)) {
- return null;
- }
- $content = @file_get_contents($file);
- if (!$content) {
- return null;
- }
- $xml = new SimpleXMLElement($content);
- $data['info'] = array();
- $data['remote'] = array();
- $data['public'] = array();
- foreach ($xml->children() as $child) {
- /**
- * @var $child SimpleXMLElement
- */
- if ($child->getName() == 'remote') {
- foreach ($child->children() as $remote) {
- /**
- * @var $remote SimpleXMLElement
- */
- $data['remote'][$remote->getName()] = (string)$remote;
- }
- } elseif ($child->getName() == 'public') {
- foreach ($child->children() as $public) {
- /**
- * @var $public SimpleXMLElement
- */
- $data['public'][$public->getName()] = (string)$public;
- }
- } elseif ($child->getName() == 'types') {
- $data['types'] = array();
- foreach ($child->children() as $type) {
- /**
- * @var $type SimpleXMLElement
- */
- $data['types'][] = $type->getName();
- }
- } elseif ($child->getName() == 'description') {
- $xml = (string)$child->asXML();
- $data[$child->getName()] = substr($xml, 13, -14); //script <description> tags
- } elseif ($child->getName() == 'documentation') {
- foreach ($child as $subChild) {
- $url = (string) $subChild;
-
- // If it is not an absolute URL we assume it is a key
- // i.e. admin-ldap will get converted to go.php?to=admin-ldap
- if(!\OC::$server->getHTTPHelper()->isHTTPURL($url)) {
- $url = OC_Helper::linkToDocs($url);
- }
- $data["documentation"][$subChild->getName()] = $url;
- }
- } else {
- $data[$child->getName()] = (string)$child;
- }
- }
+ $parser = new \OC\App\InfoParser(\OC::$server->getHTTPHelper(), \OC::$server->getURLGenerator());
+ $data = $parser->parse($file);
+
self::$appInfo[$appId] = $data;
return $data;
diff --git a/lib/private/app/infoparser.php b/lib/private/app/infoparser.php
new file mode 100644
index 00000000000..b4bdbea5c04
--- /dev/null
+++ b/lib/private/app/infoparser.php
@@ -0,0 +1,84 @@
+<?php
+ /**
+ * @author Thomas Müller
+ * @copyright 2014 Thomas Müller deepdiver@owncloud.com
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\App;
+
+use OCP\IURLGenerator;
+
+class InfoParser {
+ /**
+ * @var \OC\HTTPHelper
+ */
+ private $httpHelper;
+
+ /**
+ * @var IURLGenerator
+ */
+ private $urlGenerator;
+
+ /**
+ * @param \OC\HTTPHelper $httpHelper
+ * @param IURLGenerator $urlGenerator
+ */
+ public function __construct(\OC\HTTPHelper $httpHelper, IURLGenerator $urlGenerator) {
+ $this->httpHelper = $httpHelper;
+ $this->urlGenerator = $urlGenerator;
+ }
+
+ /**
+ * @param string $file the xml file to be loaded
+ * @return null|array where null is an indicator for an error
+ */
+ public function parse($file) {
+ if (!file_exists($file)) {
+ return null;
+ }
+
+ $loadEntities = libxml_disable_entity_loader(false);
+ $xml = @simplexml_load_file($file);
+ libxml_disable_entity_loader($loadEntities);
+ if ($xml == false) {
+ return null;
+ }
+ $array = json_decode(json_encode((array)$xml), TRUE);
+ if (is_null($array)) {
+ return null;
+ }
+ if (!array_key_exists('info', $array)) {
+ $array['info'] = array();
+ }
+ if (!array_key_exists('remote', $array)) {
+ $array['remote'] = array();
+ }
+ if (!array_key_exists('public', $array)) {
+ $array['public'] = array();
+ }
+
+ if (array_key_exists('documentation', $array)) {
+ foreach ($array['documentation'] as $key => $url) {
+ // If it is not an absolute URL we assume it is a key
+ // i.e. admin-ldap will get converted to go.php?to=admin-ldap
+ if (!$this->httpHelper->isHTTPURL($url)) {
+ $url = $this->urlGenerator->linkToDocs($url);
+ }
+
+ $array['documentation'][$key] = $url;
+ }
+ }
+ if (array_key_exists('types', $array)) {
+ foreach ($array['types'] as $type => $v) {
+ unset($array['types'][$type]);
+ $array['types'][] = $type;
+ }
+ }
+
+ return $array;
+ }
+}
diff --git a/lib/private/appframework/app.php b/lib/private/appframework/app.php
index baf52d02054..f56ba4af870 100644
--- a/lib/private/appframework/app.php
+++ b/lib/private/appframework/app.php
@@ -53,7 +53,7 @@ class App {
// initialize the dispatcher and run all the middleware before the controller
$dispatcher = $container['Dispatcher'];
- list($httpHeaders, $responseHeaders, $output) =
+ list($httpHeaders, $responseHeaders, $responseCookies, $output) =
$dispatcher->dispatch($controller, $methodName);
if(!is_null($httpHeaders)) {
@@ -64,6 +64,14 @@ class App {
header($name . ': ' . $value);
}
+ foreach($responseCookies as $name => $value) {
+ $expireDate = null;
+ if($value['expireDate'] instanceof \DateTime) {
+ $expireDate = $value['expireDate']->getTimestamp();
+ }
+ setcookie($name, $value['value'], $expireDate, $container->getServer()->getWebRoot(), null, $container->getServer()->getConfig()->getSystemValue('forcessl', false), true);
+ }
+
if(!is_null($output)) {
header('Content-Length: ' . strlen($output));
print($output);
diff --git a/lib/private/appframework/http/dispatcher.php b/lib/private/appframework/http/dispatcher.php
index 29a661d5743..24540ef3c94 100644
--- a/lib/private/appframework/http/dispatcher.php
+++ b/lib/private/appframework/http/dispatcher.php
@@ -48,7 +48,7 @@ class Dispatcher {
* @param Http $protocol the http protocol with contains all status headers
* @param MiddlewareDispatcher $middlewareDispatcher the dispatcher which
* runs the middleware
- * @param ControllerMethodReflector the reflector that is used to inject
+ * @param ControllerMethodReflector $reflector the reflector that is used to inject
* the arguments for the controller
* @param IRequest $request the incoming request
*/
@@ -71,6 +71,7 @@ class Dispatcher {
* @return array $array[0] contains a string with the http main header,
* $array[1] contains headers in the form: $key => value, $array[2] contains
* the response output
+ * @throws \Exception
*/
public function dispatch(Controller $controller, $methodName) {
$out = array(null, array(), null);
@@ -102,13 +103,14 @@ class Dispatcher {
// get the output which should be printed and run the after output
// middleware to modify the response
$output = $response->render();
- $out[2] = $this->middlewareDispatcher->beforeOutput(
+ $out[3] = $this->middlewareDispatcher->beforeOutput(
$controller, $methodName, $output);
// depending on the cache object the headers need to be changed
$out[0] = $this->protocol->getStatusHeader($response->getStatus(),
$response->getLastModified(), $response->getETag());
- $out[1] = $response->getHeaders();
+ $out[1] = array_merge($response->getHeaders());
+ $out[2] = $response->getCookies();
return $out;
}
diff --git a/lib/private/arrayparser.php b/lib/private/arrayparser.php
index dab1817c2ed..1cf3355d6fa 100644
--- a/lib/private/arrayparser.php
+++ b/lib/private/arrayparser.php
@@ -21,9 +21,6 @@
namespace OC;
-class SyntaxException extends \Exception {
-}
-
class ArrayParser {
const TYPE_NUM = 1;
const TYPE_BOOL = 2;
@@ -209,7 +206,7 @@ class ArrayParser {
$bracketDepth++;
} elseif ($char === ')') {
if ($bracketDepth <= 0) {
- throw new SyntaxException;
+ throw new UnexpectedValueException();
} else {
$bracketDepth--;
}
diff --git a/lib/private/contacts/localaddressbook.php b/lib/private/contacts/localaddressbook.php
index 483bbee83f8..91ddb5798f2 100644
--- a/lib/private/contacts/localaddressbook.php
+++ b/lib/private/contacts/localaddressbook.php
@@ -91,7 +91,7 @@ class LocalAddressBook implements \OCP\IAddressBook {
* @return int
*/
public function getPermissions() {
- return \OCP\PERMISSION_READ;
+ return \OCP\Constants::PERMISSION_READ;
}
/**
diff --git a/lib/private/contactsmanager.php b/lib/private/contactsmanager.php
index 338cc048651..737fc4f0e3a 100644
--- a/lib/private/contactsmanager.php
+++ b/lib/private/contactsmanager.php
@@ -62,7 +62,7 @@ namespace OC {
return null;
}
- if ($addressBook->getPermissions() & \OCP\PERMISSION_DELETE) {
+ if ($addressBook->getPermissions() & \OCP\Constants::PERMISSION_DELETE) {
return null;
}
@@ -83,7 +83,7 @@ namespace OC {
return null;
}
- if ($addressBook->getPermissions() & \OCP\PERMISSION_CREATE) {
+ if ($addressBook->getPermissions() & \OCP\Constants::PERMISSION_CREATE) {
return null;
}
diff --git a/lib/private/databaseexception.php b/lib/private/databaseexception.php
new file mode 100644
index 00000000000..1135621ead2
--- /dev/null
+++ b/lib/private/databaseexception.php
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Copyright (c) 2012 Frank Karlitschek <frank@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC;
+
+class DatabaseException extends \Exception {
+ private $query;
+
+ //FIXME getQuery seems to be unused, maybe use parent constructor with $message, $code and $previous
+ public function __construct($message, $query = null){
+ parent::__construct($message);
+ $this->query = $query;
+ }
+
+ public function getQuery() {
+ return $this->query;
+ }
+}
diff --git a/lib/private/databasesetupexception.php b/lib/private/databasesetupexception.php
new file mode 100644
index 00000000000..9235cda8c0e
--- /dev/null
+++ b/lib/private/databasesetupexception.php
@@ -0,0 +1,12 @@
+<?php
+/**
+ * Copyright (c) 2014 Lukas Reschke <lukas@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC;
+
+class DatabaseSetupException extends HintException {
+}
diff --git a/lib/private/db.php b/lib/private/db.php
index b820281b8a3..f8015133682 100644
--- a/lib/private/db.php
+++ b/lib/private/db.php
@@ -22,20 +22,6 @@
define('MDB2_SCHEMA_DUMP_STRUCTURE', '1');
-class DatabaseException extends Exception {
- private $query;
-
- //FIXME getQuery seems to be unused, maybe use parent constructor with $message, $code and $previous
- public function __construct($message, $query = null){
- parent::__construct($message);
- $this->query = $query;
- }
-
- public function getQuery() {
- return $this->query;
- }
-}
-
/**
* This class manages the access to the database. It basically is a wrapper for
* Doctrine with some adaptions.
@@ -65,7 +51,7 @@ class OC_DB {
* @param int $limit
* @param int $offset
* @param bool $isManipulation
- * @throws DatabaseException
+ * @throws \OC\DatabaseException
* @return OC_DB_StatementWrapper prepared SQL query
*
* SQL query via Doctrine prepare(), needs to be execute()'d!
@@ -82,7 +68,7 @@ class OC_DB {
try {
$result =$connection->prepare($query, $limit, $offset);
} catch (\Doctrine\DBAL\DBALException $e) {
- throw new \DatabaseException($e->getMessage(), $query);
+ throw new \OC\DatabaseException($e->getMessage(), $query);
}
// differentiate between query and manipulation
$result = new OC_DB_StatementWrapper($result, $isManipulation);
@@ -123,7 +109,7 @@ class OC_DB {
* .. or a simple sql query string
* @param array $parameters
* @return OC_DB_StatementWrapper
- * @throws DatabaseException
+ * @throws \OC\DatabaseException
*/
static public function executeAudited( $stmt, array $parameters = null) {
if (is_string($stmt)) {
@@ -132,7 +118,7 @@ class OC_DB {
// TODO try to convert LIMIT OFFSET notation to parameters, see fixLimitClauseForMSSQL
$message = 'LIMIT and OFFSET are forbidden for portability reasons,'
. ' pass an array with \'limit\' and \'offset\' instead';
- throw new DatabaseException($message);
+ throw new \OC\DatabaseException($message);
}
$stmt = array('sql' => $stmt, 'limit' => null, 'offset' => null);
}
@@ -140,7 +126,7 @@ class OC_DB {
// convert to prepared statement
if ( ! array_key_exists('sql', $stmt) ) {
$message = 'statement array must at least contain key \'sql\'';
- throw new DatabaseException($message);
+ throw new \OC\DatabaseException($message);
}
if ( ! array_key_exists('limit', $stmt) ) {
$stmt['limit'] = null;
@@ -160,7 +146,7 @@ class OC_DB {
} else {
$message = 'Expected a prepared statement or array got ' . gettype($stmt);
}
- throw new DatabaseException($message);
+ throw new \OC\DatabaseException($message);
}
return $result;
}
@@ -169,7 +155,7 @@ class OC_DB {
* gets last value of autoincrement
* @param string $table The optional table name (will replace *PREFIX*) and add sequence suffix
* @return string id
- * @throws DatabaseException
+ * @throws \OC\DatabaseException
*
* \Doctrine\DBAL\Connection lastInsertId
*
@@ -312,7 +298,7 @@ class OC_DB {
* @param mixed $result
* @param string $message
* @return void
- * @throws DatabaseException
+ * @throws \OC\DatabaseException
*/
public static function raiseExceptionOnError($result, $message = null) {
if(self::isError($result)) {
@@ -321,7 +307,7 @@ class OC_DB {
} else {
$message .= ', Root cause:' . self::getErrorMessage($result);
}
- throw new DatabaseException($message, self::getErrorCode($result));
+ throw new \OC\DatabaseException($message, self::getErrorCode($result));
}
}
@@ -345,7 +331,7 @@ class OC_DB {
*
* @param string $table
* @return bool
- * @throws DatabaseException
+ * @throws \OC\DatabaseException
*/
public static function tableExists($table) {
@@ -381,7 +367,7 @@ class OC_DB {
$result = \OC_DB::executeAudited($sql, array($table));
break;
default:
- throw new DatabaseException("Unknown database type: $dbType");
+ throw new \OC\DatabaseException("Unknown database type: $dbType");
}
return $result->fetchOne() === $table;
diff --git a/lib/private/db/connectionfactory.php b/lib/private/db/connectionfactory.php
index f6253e09b95..58043b30440 100644
--- a/lib/private/db/connectionfactory.php
+++ b/lib/private/db/connectionfactory.php
@@ -90,7 +90,8 @@ class ConnectionFactory {
$eventManager->addEventSubscriber(new \Doctrine\DBAL\Event\Listeners\OracleSessionInit);
break;
case 'sqlite3':
- $eventManager->addEventSubscriber(new SQLiteSessionInit);
+ $journalMode = $additionalConnectionParams['sqlite.journal_mode'];
+ $eventManager->addEventSubscriber(new SQLiteSessionInit(true, $journalMode));
break;
}
$connection = \Doctrine\DBAL\DriverManager::getConnection(
@@ -153,6 +154,7 @@ class ConnectionFactory {
}
$connectionParams['tablePrefix'] = $config->getSystemValue('dbtableprefix', 'oc_');
+ $connectionParams['sqlite.journal_mode'] = $config->getSystemValue('sqlite.journal_mode', 'WAL');
//additional driver options, eg. for mysql ssl
$driverOptions = $config->getSystemValue('dbdriveroptions', null);
diff --git a/lib/private/db/sqlitesessioninit.php b/lib/private/db/sqlitesessioninit.php
index 7e1166be95b..1fff22b883a 100644
--- a/lib/private/db/sqlitesessioninit.php
+++ b/lib/private/db/sqlitesessioninit.php
@@ -19,12 +19,19 @@ class SQLiteSessionInit implements EventSubscriber {
private $caseSensitiveLike;
/**
+ * @var string
+ */
+ private $journalMode;
+
+ /**
* Configure case sensitive like for each connection
*
* @param bool $caseSensitiveLike
+ * @param string $journalMode
*/
- public function __construct($caseSensitiveLike = true) {
+ public function __construct($caseSensitiveLike, $journalMode) {
$this->caseSensitiveLike = $caseSensitiveLike;
+ $this->journalMode = $journalMode;
}
/**
@@ -34,6 +41,7 @@ class SQLiteSessionInit implements EventSubscriber {
public function postConnect(ConnectionEventArgs $args) {
$sensitive = ($this->caseSensitiveLike) ? 'true' : 'false';
$args->getConnection()->executeUpdate('PRAGMA case_sensitive_like = ' . $sensitive);
+ $args->getConnection()->executeUpdate('PRAGMA journal_mode = ' . $this->journalMode);
}
public function getSubscribedEvents() {
diff --git a/lib/private/files.php b/lib/private/files.php
index 571d3215caa..98f3c52d6c6 100644
--- a/lib/private/files.php
+++ b/lib/private/files.php
@@ -24,17 +24,14 @@
// TODO: get rid of this using proper composer packages
require_once 'mcnetic/phpzipstreamer/ZipStreamer.php';
-class GET_TYPE {
- const FILE = 1;
- const ZIP_FILES = 2;
- const ZIP_DIR = 3;
-}
-
/**
* Class for file server access
*
*/
class OC_Files {
+ const FILE = 1;
+ const ZIP_FILES = 2;
+ const ZIP_DIR = 3;
/**
* @param string $filename
@@ -76,7 +73,7 @@ class OC_Files {
}
if (is_array($files)) {
- $get_type = GET_TYPE::ZIP_FILES;
+ $get_type = self::ZIP_FILES;
$basename = basename($dir);
if ($basename) {
$name = $basename . '.zip';
@@ -88,7 +85,7 @@ class OC_Files {
} else {
$filename = $dir . '/' . $files;
if (\OC\Files\Filesystem::is_dir($dir . '/' . $files)) {
- $get_type = GET_TYPE::ZIP_DIR;
+ $get_type = self::ZIP_DIR;
// downloading root ?
if ($files === '') {
$name = 'download.zip';
@@ -97,12 +94,12 @@ class OC_Files {
}
} else {
- $get_type = GET_TYPE::FILE;
+ $get_type = self::FILE;
$name = $files;
}
}
- if ($get_type === GET_TYPE::FILE) {
+ if ($get_type === self::FILE) {
$zip = false;
if ($xsendfile && OC_App::isEnabled('files_encryption')) {
$xsendfile = false;
@@ -127,7 +124,7 @@ class OC_Files {
if ($zip) {
$executionTime = intval(ini_get('max_execution_time'));
set_time_limit(0);
- if ($get_type === GET_TYPE::ZIP_FILES) {
+ if ($get_type === self::ZIP_FILES) {
foreach ($files as $file) {
$file = $dir . '/' . $file;
if (\OC\Files\Filesystem::is_file($file)) {
@@ -138,7 +135,7 @@ class OC_Files {
self::zipAddDir($file, $zip);
}
}
- } elseif ($get_type === GET_TYPE::ZIP_DIR) {
+ } elseif ($get_type === self::ZIP_DIR) {
$file = $dir . '/' . $files;
self::zipAddDir($file, $zip);
}
diff --git a/lib/private/files/cache/cache.php b/lib/private/files/cache/cache.php
index 2c12f834518..4157da2281c 100644
--- a/lib/private/files/cache/cache.php
+++ b/lib/private/files/cache/cache.php
@@ -585,7 +585,7 @@ class Cache {
/**
* find a folder in the cache which has not been fully scanned
*
- * If multiply incomplete folders are in the cache, the one with the highest id will be returned,
+ * If multiple incomplete folders are in the cache, the one with the highest id will be returned,
* use the one with the highest id gives the best result with the background scanner, since that is most
* likely the folder where we stopped scanning previously
*
diff --git a/lib/private/files/cache/wrapper/cachejail.php b/lib/private/files/cache/wrapper/cachejail.php
new file mode 100644
index 00000000000..7982293f5ed
--- /dev/null
+++ b/lib/private/files/cache/wrapper/cachejail.php
@@ -0,0 +1,255 @@
+<?php
+/**
+ * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Files\Cache\Wrapper;
+
+/**
+ * Jail to a subdirectory of the wrapped cache
+ */
+class CacheJail extends CacheWrapper {
+ /**
+ * @var string
+ */
+ protected $root;
+
+ /**
+ * @param \OC\Files\Cache\Cache $cache
+ * @param string $root
+ */
+ public function __construct($cache, $root) {
+ parent::__construct($cache);
+ $this->root = $root;
+ }
+
+ protected function getSourcePath($path) {
+ if ($path === '') {
+ return $this->root;
+ } else {
+ return $this->root . '/' . $path;
+ }
+ }
+
+ /**
+ * @param string $path
+ * @return null|string the jailed path or null if the path is outside the jail
+ */
+ protected function getJailedPath($path) {
+ $rootLength = strlen($this->root) + 1;
+ if ($path === $this->root) {
+ return '';
+ } else if (substr($path, 0, $rootLength) === $this->root . '/') {
+ return substr($path, $rootLength);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * @param array $entry
+ * @return array
+ */
+ protected function formatCacheEntry($entry) {
+ if (isset($entry['path'])) {
+ $entry['path'] = $this->getJailedPath($entry['path']);
+ }
+ return $entry;
+ }
+
+ protected function filterCacheEntry($entry) {
+ $rootLength = strlen($this->root) + 1;
+ return ($entry['path'] === $this->root) or (substr($entry['path'], 0, $rootLength) === $this->root . '/');
+ }
+
+ /**
+ * get the stored metadata of a file or folder
+ *
+ * @param string /int $file
+ * @return array|false
+ */
+ public function get($file) {
+ if (is_string($file) or $file == '') {
+ $file = $this->getSourcePath($file);
+ }
+ return parent::get($file);
+ }
+
+ /**
+ * store meta data for a file or folder
+ *
+ * @param string $file
+ * @param array $data
+ *
+ * @return int file id
+ */
+ public function put($file, array $data) {
+ return $this->cache->put($this->getSourcePath($file), $data);
+ }
+
+ /**
+ * update the metadata in the cache
+ *
+ * @param int $id
+ * @param array $data
+ */
+ public function update($id, array $data) {
+ $this->cache->update($this->getSourcePath($id), $data);
+ }
+
+ /**
+ * get the file id for a file
+ *
+ * @param string $file
+ * @return int
+ */
+ public function getId($file) {
+ return $this->cache->getId($this->getSourcePath($file));
+ }
+
+ /**
+ * get the id of the parent folder of a file
+ *
+ * @param string $file
+ * @return int
+ */
+ public function getParentId($file) {
+ if ($file === '') {
+ return -1;
+ } else {
+ return $this->cache->getParentId($this->getSourcePath($file));
+ }
+ }
+
+ /**
+ * check if a file is available in the cache
+ *
+ * @param string $file
+ * @return bool
+ */
+ public function inCache($file) {
+ return $this->cache->inCache($this->getSourcePath($file));
+ }
+
+ /**
+ * remove a file or folder from the cache
+ *
+ * @param string $file
+ */
+ public function remove($file) {
+ $this->cache->remove($this->getSourcePath($file));
+ }
+
+ /**
+ * Move a file or folder in the cache
+ *
+ * @param string $source
+ * @param string $target
+ */
+ public function move($source, $target) {
+ $this->cache->move($this->getSourcePath($source), $this->getSourcePath($target));
+ }
+
+ /**
+ * remove all entries for files that are stored on the storage from the cache
+ */
+ public function clear() {
+ $this->cache->remove($this->root);
+ }
+
+ /**
+ * @param string $file
+ *
+ * @return int, Cache::NOT_FOUND, Cache::PARTIAL, Cache::SHALLOW or Cache::COMPLETE
+ */
+ public function getStatus($file) {
+ return $this->cache->getStatus($this->getSourcePath($file));
+ }
+
+ private function formatSearchResults($results) {
+ $results = array_filter($results, array($this, 'filterCacheEntry'));
+ $results = array_values($results);
+ return array_map(array($this, 'formatCacheEntry'), $results);
+ }
+
+ /**
+ * search for files matching $pattern
+ *
+ * @param string $pattern
+ * @return array an array of file data
+ */
+ public function search($pattern) {
+ $results = $this->cache->search($pattern);
+ return $this->formatSearchResults($results);
+ }
+
+ /**
+ * search for files by mimetype
+ *
+ * @param string $mimetype
+ * @return array
+ */
+ public function searchByMime($mimetype) {
+ $results = $this->cache->searchByMime($mimetype);
+ return $this->formatSearchResults($results);
+ }
+
+ /**
+ * update the folder size and the size of all parent folders
+ *
+ * @param string|boolean $path
+ * @param array $data (optional) meta data of the folder
+ */
+ public function correctFolderSize($path, $data = null) {
+ $this->cache->correctFolderSize($this->getSourcePath($path), $data);
+ }
+
+ /**
+ * get the size of a folder and set it in the cache
+ *
+ * @param string $path
+ * @param array $entry (optional) meta data of the folder
+ * @return int
+ */
+ public function calculateFolderSize($path, $entry = null) {
+ return $this->cache->calculateFolderSize($this->getSourcePath($path), $entry);
+ }
+
+ /**
+ * get all file ids on the files on the storage
+ *
+ * @return int[]
+ */
+ public function getAll() {
+ // not supported
+ return array();
+ }
+
+ /**
+ * find a folder in the cache which has not been fully scanned
+ *
+ * If multiply incomplete folders are in the cache, the one with the highest id will be returned,
+ * use the one with the highest id gives the best result with the background scanner, since that is most
+ * likely the folder where we stopped scanning previously
+ *
+ * @return string|bool the path of the folder or false when no folder matched
+ */
+ public function getIncomplete() {
+ // not supported
+ return false;
+ }
+
+ /**
+ * get the path of a file on this storage by it's id
+ *
+ * @param int $id
+ * @return string|null
+ */
+ public function getPathById($id) {
+ $path = $this->cache->getPathById($id);
+ return $this->getJailedPath($path);
+ }
+}
diff --git a/lib/private/files/cache/wrapper/cachepermissionsmask.php b/lib/private/files/cache/wrapper/cachepermissionsmask.php
new file mode 100644
index 00000000000..6ce6a4ebc44
--- /dev/null
+++ b/lib/private/files/cache/wrapper/cachepermissionsmask.php
@@ -0,0 +1,32 @@
+<?php
+/**
+ * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Files\Cache\Wrapper;
+
+class CachePermissionsMask extends CacheWrapper {
+ /**
+ * @var int
+ */
+ protected $mask;
+
+ /**
+ * @param \OC\Files\Cache\Cache $cache
+ * @param int $mask
+ */
+ public function __construct($cache, $mask) {
+ parent::__construct($cache);
+ $this->mask = $mask;
+ }
+
+ protected function formatCacheEntry($entry) {
+ if (isset($entry['permissions'])) {
+ $entry['permissions'] &= $this->mask;
+ }
+ return $entry;
+ }
+}
diff --git a/lib/private/files/cache/wrapper/cachewrapper.php b/lib/private/files/cache/wrapper/cachewrapper.php
new file mode 100644
index 00000000000..040358ec657
--- /dev/null
+++ b/lib/private/files/cache/wrapper/cachewrapper.php
@@ -0,0 +1,247 @@
+<?php
+/**
+ * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Files\Cache\Wrapper;
+
+use OC\Files\Cache\Cache;
+
+class CacheWrapper extends Cache {
+ /**
+ * @var \OC\Files\Cache\Cache
+ */
+ protected $cache;
+
+ /**
+ * @param \OC\Files\Cache\Cache $cache
+ */
+ public function __construct($cache) {
+ $this->cache = $cache;
+ }
+
+ /**
+ * Make it easy for wrappers to modify every returned cache entry
+ *
+ * @param array $entry
+ * @return array
+ */
+ protected function formatCacheEntry($entry) {
+ return $entry;
+ }
+
+ /**
+ * get the stored metadata of a file or folder
+ *
+ * @param string /int $file
+ * @return array|false
+ */
+ public function get($file) {
+ $result = $this->cache->get($file);
+ if ($result) {
+ $result = $this->formatCacheEntry($result);
+ }
+ return $result;
+ }
+
+ /**
+ * get the metadata of all files stored in $folder
+ *
+ * @param string $folder
+ * @return array
+ */
+ public function getFolderContents($folder) {
+ // cant do a simple $this->cache->.... call here since getFolderContentsById needs to be called on this
+ // and not the wrapped cache
+ $fileId = $this->getId($folder);
+ return $this->getFolderContentsById($fileId);
+ }
+
+ /**
+ * get the metadata of all files stored in $folder
+ *
+ * @param int $fileId the file id of the folder
+ * @return array
+ */
+ public function getFolderContentsById($fileId) {
+ $results = $this->cache->getFolderContentsById($fileId);
+ return array_map(array($this, 'formatCacheEntry'), $results);
+ }
+
+ /**
+ * store meta data for a file or folder
+ *
+ * @param string $file
+ * @param array $data
+ *
+ * @return int file id
+ */
+ public function put($file, array $data) {
+ return $this->cache->put($file, $data);
+ }
+
+ /**
+ * update the metadata in the cache
+ *
+ * @param int $id
+ * @param array $data
+ */
+ public function update($id, array $data) {
+ $this->cache->update($id, $data);
+ }
+
+ /**
+ * get the file id for a file
+ *
+ * @param string $file
+ * @return int
+ */
+ public function getId($file) {
+ return $this->cache->getId($file);
+ }
+
+ /**
+ * get the id of the parent folder of a file
+ *
+ * @param string $file
+ * @return int
+ */
+ public function getParentId($file) {
+ return $this->cache->getParentId($file);
+ }
+
+ /**
+ * check if a file is available in the cache
+ *
+ * @param string $file
+ * @return bool
+ */
+ public function inCache($file) {
+ return $this->cache->inCache($file);
+ }
+
+ /**
+ * remove a file or folder from the cache
+ *
+ * @param string $file
+ */
+ public function remove($file) {
+ $this->cache->remove($file);
+ }
+
+ /**
+ * Move a file or folder in the cache
+ *
+ * @param string $source
+ * @param string $target
+ */
+ public function move($source, $target) {
+ $this->cache->move($source, $target);
+ }
+
+ /**
+ * remove all entries for files that are stored on the storage from the cache
+ */
+ public function clear() {
+ $this->cache->clear();
+ }
+
+ /**
+ * @param string $file
+ *
+ * @return int, Cache::NOT_FOUND, Cache::PARTIAL, Cache::SHALLOW or Cache::COMPLETE
+ */
+ public function getStatus($file) {
+ return $this->cache->getStatus($file);
+ }
+
+ /**
+ * search for files matching $pattern
+ *
+ * @param string $pattern
+ * @return array an array of file data
+ */
+ public function search($pattern) {
+ $results = $this->cache->search($pattern);
+ return array_map(array($this, 'formatCacheEntry'), $results);
+ }
+
+ /**
+ * search for files by mimetype
+ *
+ * @param string $mimetype
+ * @return array
+ */
+ public function searchByMime($mimetype) {
+ $results = $this->cache->searchByMime($mimetype);
+ return array_map(array($this, 'formatCacheEntry'), $results);
+ }
+
+ /**
+ * update the folder size and the size of all parent folders
+ *
+ * @param string|boolean $path
+ * @param array $data (optional) meta data of the folder
+ */
+ public function correctFolderSize($path, $data = null) {
+ $this->cache->correctFolderSize($path, $data);
+ }
+
+ /**
+ * get the size of a folder and set it in the cache
+ *
+ * @param string $path
+ * @param array $entry (optional) meta data of the folder
+ * @return int
+ */
+ public function calculateFolderSize($path, $entry = null) {
+ return $this->cache->calculateFolderSize($path, $entry);
+ }
+
+ /**
+ * get all file ids on the files on the storage
+ *
+ * @return int[]
+ */
+ public function getAll() {
+ return $this->cache->getAll();
+ }
+
+ /**
+ * find a folder in the cache which has not been fully scanned
+ *
+ * If multiple incomplete folders are in the cache, the one with the highest id will be returned,
+ * use the one with the highest id gives the best result with the background scanner, since that is most
+ * likely the folder where we stopped scanning previously
+ *
+ * @return string|bool the path of the folder or false when no folder matched
+ */
+ public function getIncomplete() {
+ return $this->cache->getIncomplete();
+ }
+
+ /**
+ * get the path of a file on this storage by it's id
+ *
+ * @param int $id
+ * @return string|null
+ */
+ public function getPathById($id) {
+ return $this->cache->getPathById($id);
+ }
+
+ /**
+ * get the storage id of the storage for a file and the internal path of the file
+ * unlike getPathById this does not limit the search to files on this storage and
+ * instead does a global search in the cache table
+ *
+ * @param int $id
+ * @return array, first element holding the storage id, second the path
+ */
+ static public function getById($id) {
+ return parent::getById($id);
+ }
+}
diff --git a/lib/private/files/fileinfo.php b/lib/private/files/fileinfo.php
index d6d6a245e44..8bab51f0737 100644
--- a/lib/private/files/fileinfo.php
+++ b/lib/private/files/fileinfo.php
@@ -173,14 +173,14 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
* @return bool
*/
public function isReadable() {
- return $this->checkPermissions(\OCP\PERMISSION_READ);
+ return $this->checkPermissions(\OCP\Constants::PERMISSION_READ);
}
/**
* @return bool
*/
public function isUpdateable() {
- return $this->checkPermissions(\OCP\PERMISSION_UPDATE);
+ return $this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE);
}
/**
@@ -189,21 +189,21 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
* @return bool
*/
public function isCreatable() {
- return $this->checkPermissions(\OCP\PERMISSION_CREATE);
+ return $this->checkPermissions(\OCP\Constants::PERMISSION_CREATE);
}
/**
* @return bool
*/
public function isDeletable() {
- return $this->checkPermissions(\OCP\PERMISSION_DELETE);
+ return $this->checkPermissions(\OCP\Constants::PERMISSION_DELETE);
}
/**
* @return bool
*/
public function isShareable() {
- return $this->checkPermissions(\OCP\PERMISSION_SHARE);
+ return $this->checkPermissions(\OCP\Constants::PERMISSION_SHARE);
}
/**
diff --git a/lib/private/files/node/file.php b/lib/private/files/node/file.php
index 75d5e0166b6..81e251c20b8 100644
--- a/lib/private/files/node/file.php
+++ b/lib/private/files/node/file.php
@@ -16,7 +16,7 @@ class File extends Node implements \OCP\Files\File {
* @throws \OCP\Files\NotPermittedException
*/
public function getContent() {
- if ($this->checkPermissions(\OCP\PERMISSION_READ)) {
+ if ($this->checkPermissions(\OCP\Constants::PERMISSION_READ)) {
/**
* @var \OC\Files\Storage\Storage $storage;
*/
@@ -31,7 +31,7 @@ class File extends Node implements \OCP\Files\File {
* @throws \OCP\Files\NotPermittedException
*/
public function putContent($data) {
- if ($this->checkPermissions(\OCP\PERMISSION_UPDATE)) {
+ if ($this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE)) {
$this->sendHooks(array('preWrite'));
$this->view->file_put_contents($this->path, $data);
$this->sendHooks(array('postWrite'));
@@ -55,7 +55,7 @@ class File extends Node implements \OCP\Files\File {
public function fopen($mode) {
$preHooks = array();
$postHooks = array();
- $requiredPermissions = \OCP\PERMISSION_READ;
+ $requiredPermissions = \OCP\Constants::PERMISSION_READ;
switch ($mode) {
case 'r+':
case 'rb+':
@@ -73,7 +73,7 @@ class File extends Node implements \OCP\Files\File {
case 'ab':
$preHooks[] = 'preWrite';
$postHooks[] = 'postWrite';
- $requiredPermissions |= \OCP\PERMISSION_UPDATE;
+ $requiredPermissions |= \OCP\Constants::PERMISSION_UPDATE;
break;
}
@@ -88,7 +88,7 @@ class File extends Node implements \OCP\Files\File {
}
public function delete() {
- if ($this->checkPermissions(\OCP\PERMISSION_DELETE)) {
+ if ($this->checkPermissions(\OCP\Constants::PERMISSION_DELETE)) {
$this->sendHooks(array('preDelete'));
$this->view->unlink($this->path);
$nonExisting = new NonExistingFile($this->root, $this->view, $this->path);
diff --git a/lib/private/files/node/folder.php b/lib/private/files/node/folder.php
index 8c7acc339ae..83e20871528 100644
--- a/lib/private/files/node/folder.php
+++ b/lib/private/files/node/folder.php
@@ -180,7 +180,7 @@ class Folder extends Node implements \OCP\Files\Folder {
* @throws \OCP\Files\NotPermittedException
*/
public function newFolder($path) {
- if ($this->checkPermissions(\OCP\PERMISSION_CREATE)) {
+ if ($this->checkPermissions(\OCP\Constants::PERMISSION_CREATE)) {
$fullPath = $this->getFullPath($path);
$nonExisting = new NonExistingFolder($this->root, $this->view, $fullPath);
$this->root->emit('\OC\Files', 'preWrite', array($nonExisting));
@@ -201,7 +201,7 @@ class Folder extends Node implements \OCP\Files\Folder {
* @throws \OCP\Files\NotPermittedException
*/
public function newFile($path) {
- if ($this->checkPermissions(\OCP\PERMISSION_CREATE)) {
+ if ($this->checkPermissions(\OCP\Constants::PERMISSION_CREATE)) {
$fullPath = $this->getFullPath($path);
$nonExisting = new NonExistingFile($this->root, $this->view, $fullPath);
$this->root->emit('\OC\Files', 'preWrite', array($nonExisting));
@@ -325,11 +325,11 @@ class Folder extends Node implements \OCP\Files\Folder {
* @return bool
*/
public function isCreatable() {
- return $this->checkPermissions(\OCP\PERMISSION_CREATE);
+ return $this->checkPermissions(\OCP\Constants::PERMISSION_CREATE);
}
public function delete() {
- if ($this->checkPermissions(\OCP\PERMISSION_DELETE)) {
+ if ($this->checkPermissions(\OCP\Constants::PERMISSION_DELETE)) {
$this->sendHooks(array('preDelete'));
$this->view->rmdir($this->path);
$nonExisting = new NonExistingFolder($this->root, $this->view, $this->path);
diff --git a/lib/private/files/node/node.php b/lib/private/files/node/node.php
index bc075911749..c52f5bbd54f 100644
--- a/lib/private/files/node/node.php
+++ b/lib/private/files/node/node.php
@@ -81,7 +81,7 @@ class Node implements \OCP\Files\Node {
* @throws \OCP\Files\NotPermittedException
*/
public function touch($mtime = null) {
- if ($this->checkPermissions(\OCP\PERMISSION_UPDATE)) {
+ if ($this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE)) {
$this->sendHooks(array('preTouch'));
$this->view->touch($this->path, $mtime);
$this->sendHooks(array('postTouch'));
@@ -163,28 +163,28 @@ class Node implements \OCP\Files\Node {
* @return bool
*/
public function isReadable() {
- return $this->checkPermissions(\OCP\PERMISSION_READ);
+ return $this->checkPermissions(\OCP\Constants::PERMISSION_READ);
}
/**
* @return bool
*/
public function isUpdateable() {
- return $this->checkPermissions(\OCP\PERMISSION_UPDATE);
+ return $this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE);
}
/**
* @return bool
*/
public function isDeletable() {
- return $this->checkPermissions(\OCP\PERMISSION_DELETE);
+ return $this->checkPermissions(\OCP\Constants::PERMISSION_DELETE);
}
/**
* @return bool
*/
public function isShareable() {
- return $this->checkPermissions(\OCP\PERMISSION_SHARE);
+ return $this->checkPermissions(\OCP\Constants::PERMISSION_SHARE);
}
/**
diff --git a/lib/private/files/node/root.php b/lib/private/files/node/root.php
index 18e7a6b681a..1e8387dc5cb 100644
--- a/lib/private/files/node/root.php
+++ b/lib/private/files/node/root.php
@@ -262,7 +262,7 @@ class Root extends Folder implements Emitter {
* @return int
*/
public function getPermissions() {
- return \OCP\PERMISSION_CREATE;
+ return \OCP\Constants::PERMISSION_CREATE;
}
/**
diff --git a/lib/private/files/objectstore/objectstorestorage.php b/lib/private/files/objectstore/objectstorestorage.php
index ae8bff52896..b0095ad94bb 100644
--- a/lib/private/files/objectstore/objectstorestorage.php
+++ b/lib/private/files/objectstore/objectstorestorage.php
@@ -72,7 +72,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
'size' => 0,
'mtime' => $mTime,
'storage_mtime' => $mTime,
- 'permissions' => \OCP\PERMISSION_ALL,
+ 'permissions' => \OCP\Constants::PERMISSION_ALL,
);
if ($dirName === '' && !$parentExists) {
@@ -332,7 +332,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
'size' => 0,
'mtime' => $mtime,
'storage_mtime' => $mtime,
- 'permissions' => \OCP\PERMISSION_ALL,
+ 'permissions' => \OCP\Constants::PERMISSION_ALL,
);
$fileId = $this->getCache()->put($path, $stat);
try {
@@ -357,7 +357,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
if (empty($stat)) {
// create new file
$stat = array(
- 'permissions' => \OCP\PERMISSION_ALL,
+ 'permissions' => \OCP\Constants::PERMISSION_ALL,
);
}
// update stat with new data
diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php
index 518d3ec400c..d76c6aa031b 100644
--- a/lib/private/files/storage/common.php
+++ b/lib/private/files/storage/common.php
@@ -113,19 +113,19 @@ abstract class Common implements \OC\Files\Storage\Storage {
public function getPermissions($path) {
$permissions = 0;
if ($this->isCreatable($path)) {
- $permissions |= \OCP\PERMISSION_CREATE;
+ $permissions |= \OCP\Constants::PERMISSION_CREATE;
}
if ($this->isReadable($path)) {
- $permissions |= \OCP\PERMISSION_READ;
+ $permissions |= \OCP\Constants::PERMISSION_READ;
}
if ($this->isUpdatable($path)) {
- $permissions |= \OCP\PERMISSION_UPDATE;
+ $permissions |= \OCP\Constants::PERMISSION_UPDATE;
}
if ($this->isDeletable($path)) {
- $permissions |= \OCP\PERMISSION_DELETE;
+ $permissions |= \OCP\Constants::PERMISSION_DELETE;
}
if ($this->isSharable($path)) {
- $permissions |= \OCP\PERMISSION_SHARE;
+ $permissions |= \OCP\Constants::PERMISSION_SHARE;
}
return $permissions;
}
diff --git a/lib/private/files/storage/dav.php b/lib/private/files/storage/dav.php
index 26fa69408a8..a2832bce009 100644
--- a/lib/private/files/storage/dav.php
+++ b/lib/private/files/storage/dav.php
@@ -416,19 +416,19 @@ class DAV extends \OC\Files\Storage\Common {
}
public function isUpdatable($path) {
- return (bool)($this->getPermissions($path) & \OCP\PERMISSION_UPDATE);
+ return (bool)($this->getPermissions($path) & \OCP\Constants::PERMISSION_UPDATE);
}
public function isCreatable($path) {
- return (bool)($this->getPermissions($path) & \OCP\PERMISSION_CREATE);
+ return (bool)($this->getPermissions($path) & \OCP\Constants::PERMISSION_CREATE);
}
public function isSharable($path) {
- return (bool)($this->getPermissions($path) & \OCP\PERMISSION_SHARE);
+ return (bool)($this->getPermissions($path) & \OCP\Constants::PERMISSION_SHARE);
}
public function isDeletable($path) {
- return (bool)($this->getPermissions($path) & \OCP\PERMISSION_DELETE);
+ return (bool)($this->getPermissions($path) & \OCP\Constants::PERMISSION_DELETE);
}
public function getPermissions($path) {
@@ -438,9 +438,9 @@ class DAV extends \OC\Files\Storage\Common {
if (isset($response['{http://owncloud.org/ns}permissions'])) {
return $this->parsePermissions($response['{http://owncloud.org/ns}permissions']);
} else if ($this->is_dir($path)) {
- return \OCP\PERMISSION_ALL;
+ return \OCP\Constants::PERMISSION_ALL;
} else if ($this->file_exists($path)) {
- return \OCP\PERMISSION_ALL - \OCP\PERMISSION_CREATE;
+ return \OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_CREATE;
} else {
return 0;
}
@@ -451,19 +451,19 @@ class DAV extends \OC\Files\Storage\Common {
* @return int
*/
protected function parsePermissions($permissionsString) {
- $permissions = \OCP\PERMISSION_READ;
+ $permissions = \OCP\Constants::PERMISSION_READ;
if (strpos($permissionsString, 'R') !== false) {
- $permissions |= \OCP\PERMISSION_SHARE;
+ $permissions |= \OCP\Constants::PERMISSION_SHARE;
}
if (strpos($permissionsString, 'D') !== false) {
- $permissions |= \OCP\PERMISSION_DELETE;
+ $permissions |= \OCP\Constants::PERMISSION_DELETE;
}
if (strpos($permissionsString, 'W') !== false) {
- $permissions |= \OCP\PERMISSION_UPDATE;
+ $permissions |= \OCP\Constants::PERMISSION_UPDATE;
}
if (strpos($permissionsString, 'CK') !== false) {
- $permissions |= \OCP\PERMISSION_CREATE;
- $permissions |= \OCP\PERMISSION_UPDATE;
+ $permissions |= \OCP\Constants::PERMISSION_CREATE;
+ $permissions |= \OCP\Constants::PERMISSION_UPDATE;
}
return $permissions;
}
diff --git a/lib/private/files/storage/local.php b/lib/private/files/storage/local.php
index 1c5fafc12fa..7b4abf08f44 100644
--- a/lib/private/files/storage/local.php
+++ b/lib/private/files/storage/local.php
@@ -35,7 +35,7 @@ if (\OC_Util::runningOnWindows()) {
}
public function mkdir($path) {
- return @mkdir($this->datadir . $path, 0777, true);
+ return @mkdir($this->getSourcePath($path), 0777, true);
}
public function rmdir($path) {
@@ -44,7 +44,7 @@ if (\OC_Util::runningOnWindows()) {
}
try {
$it = new \RecursiveIteratorIterator(
- new \RecursiveDirectoryIterator($this->datadir . $path),
+ new \RecursiveDirectoryIterator($this->getSourcePath($path)),
\RecursiveIteratorIterator::CHILD_FIRST
);
/**
@@ -68,30 +68,30 @@ if (\OC_Util::runningOnWindows()) {
}
$it->next();
}
- return rmdir($this->datadir . $path);
+ return rmdir($this->getSourcePath($path));
} catch (\UnexpectedValueException $e) {
return false;
}
}
public function opendir($path) {
- return opendir($this->datadir . $path);
+ return opendir($this->getSourcePath($path));
}
public function is_dir($path) {
if (substr($path, -1) == '/') {
$path = substr($path, 0, -1);
}
- return is_dir($this->datadir . $path);
+ return is_dir($this->getSourcePath($path));
}
public function is_file($path) {
- return is_file($this->datadir . $path);
+ return is_file($this->getSourcePath($path));
}
public function stat($path) {
clearstatcache();
- $fullPath = $this->datadir . $path;
+ $fullPath = $this->getSourcePath($path);
$statResult = stat($fullPath);
if (PHP_INT_SIZE === 4 && !$this->is_dir($path)) {
$filesize = $this->filesize($path);
@@ -102,9 +102,9 @@ if (\OC_Util::runningOnWindows()) {
}
public function filetype($path) {
- $filetype = filetype($this->datadir . $path);
+ $filetype = filetype($this->getSourcePath($path));
if ($filetype == 'link') {
- $filetype = filetype(realpath($this->datadir . $path));
+ $filetype = filetype(realpath($this->getSourcePath($path)));
}
return $filetype;
}
@@ -113,7 +113,7 @@ if (\OC_Util::runningOnWindows()) {
if ($this->is_dir($path)) {
return 0;
}
- $fullPath = $this->datadir . $path;
+ $fullPath = $this->getSourcePath($path);
if (PHP_INT_SIZE === 4) {
$helper = new \OC\LargeFileHelper;
return $helper->getFilesize($fullPath);
@@ -122,19 +122,19 @@ if (\OC_Util::runningOnWindows()) {
}
public function isReadable($path) {
- return is_readable($this->datadir . $path);
+ return is_readable($this->getSourcePath($path));
}
public function isUpdatable($path) {
- return is_writable($this->datadir . $path);
+ return is_writable($this->getSourcePath($path));
}
public function file_exists($path) {
- return file_exists($this->datadir . $path);
+ return file_exists($this->getSourcePath($path));
}
public function filemtime($path) {
- return filemtime($this->datadir . $path);
+ return filemtime($this->getSourcePath($path));
}
public function touch($path, $mtime = null) {
@@ -145,30 +145,30 @@ if (\OC_Util::runningOnWindows()) {
return false;
}
if (!is_null($mtime)) {
- $result = touch($this->datadir . $path, $mtime);
+ $result = touch($this->getSourcePath($path), $mtime);
} else {
- $result = touch($this->datadir . $path);
+ $result = touch($this->getSourcePath($path));
}
if ($result) {
- clearstatcache(true, $this->datadir . $path);
+ clearstatcache(true, $this->getSourcePath($path));
}
return $result;
}
public function file_get_contents($path) {
- return file_get_contents($this->datadir . $path);
+ return file_get_contents($this->getSourcePath($path));
}
- public function file_put_contents($path, $data) { //trigger_error("$path = ".var_export($path, 1));
- return file_put_contents($this->datadir . $path, $data);
+ public function file_put_contents($path, $data) {
+ return file_put_contents($this->getSourcePath($path), $data);
}
public function unlink($path) {
if ($this->is_dir($path)) {
return $this->rmdir($path);
} else if ($this->is_file($path)) {
- return unlink($this->datadir . $path);
+ return unlink($this->getSourcePath($path));
} else {
return false;
}
@@ -200,27 +200,27 @@ if (\OC_Util::runningOnWindows()) {
$this->unlink($path2);
}
- return rename($this->datadir . $path1, $this->datadir . $path2);
+ return rename($this->getSourcePath($path1), $this->getSourcePath($path2));
}
public function copy($path1, $path2) {
if ($this->is_dir($path1)) {
return parent::copy($path1, $path2);
} else {
- return copy($this->datadir . $path1, $this->datadir . $path2);
+ return copy($this->getSourcePath($path1), $this->getSourcePath($path2));
}
}
public function fopen($path, $mode) {
- return fopen($this->datadir . $path, $mode);
+ return fopen($this->getSourcePath($path), $mode);
}
public function hash($type, $path, $raw = false) {
- return hash_file($type, $this->datadir . $path, $raw);
+ return hash_file($type, $this->getSourcePath($path), $raw);
}
public function free_space($path) {
- $space = @disk_free_space($this->datadir . $path);
+ $space = @disk_free_space($this->getSourcePath($path));
if ($space === false || is_null($space)) {
return \OCP\Files\FileInfo::SPACE_UNKNOWN;
}
@@ -232,11 +232,11 @@ if (\OC_Util::runningOnWindows()) {
}
public function getLocalFile($path) {
- return $this->datadir . $path;
+ return $this->getSourcePath($path);
}
public function getLocalFolder($path) {
- return $this->datadir . $path;
+ return $this->getSourcePath($path);
}
/**
@@ -244,12 +244,16 @@ if (\OC_Util::runningOnWindows()) {
*/
protected function searchInDir($query, $dir = '') {
$files = array();
- foreach (scandir($this->datadir . $dir) as $item) {
- if ($item == '.' || $item == '..') continue;
+ $physicalDir = $this->getSourcePath($dir);
+ foreach (scandir($physicalDir) as $item) {
+ if ($item == '.' || $item == '..')
+ continue;
+ $physicalItem = $physicalDir . '/' . $item;
+
if (strstr(strtolower($item), strtolower($query)) !== false) {
$files[] = $dir . '/' . $item;
}
- if (is_dir($this->datadir . $dir . '/' . $item)) {
+ if (is_dir($physicalItem)) {
$files = array_merge($files, $this->searchInDir($query, $dir . '/' . $item));
}
}
@@ -272,6 +276,17 @@ if (\OC_Util::runningOnWindows()) {
}
/**
+ * Get the source path (on disk) of a given path
+ *
+ * @param string $path
+ * @return string
+ */
+ protected function getSourcePath($path) {
+ $fullPath = $this->datadir . $path;
+ return $fullPath;
+ }
+
+ /**
* {@inheritdoc}
*/
public function isLocal() {
diff --git a/lib/private/files/storage/mappedlocal.php b/lib/private/files/storage/mappedlocal.php
index c232c0298b1..1b26e3ac0f9 100644
--- a/lib/private/files/storage/mappedlocal.php
+++ b/lib/private/files/storage/mappedlocal.php
@@ -31,7 +31,7 @@ class MappedLocal extends \OC\Files\Storage\Common {
}
public function mkdir($path) {
- return @mkdir($this->buildPath($path), 0777, true);
+ return @mkdir($this->getSourcePath($path), 0777, true);
}
public function rmdir($path) {
@@ -40,7 +40,7 @@ class MappedLocal extends \OC\Files\Storage\Common {
}
try {
$it = new \RecursiveIteratorIterator(
- new \RecursiveDirectoryIterator($this->buildPath($path)),
+ new \RecursiveDirectoryIterator($this->getSourcePath($path)),
\RecursiveIteratorIterator::CHILD_FIRST
);
/**
@@ -64,7 +64,7 @@ class MappedLocal extends \OC\Files\Storage\Common {
}
$it->next();
}
- if ($result = @rmdir($this->buildPath($path))) {
+ if ($result = @rmdir($this->getSourcePath($path))) {
$this->cleanMapper($path);
}
return $result;
@@ -75,7 +75,7 @@ class MappedLocal extends \OC\Files\Storage\Common {
public function opendir($path) {
$files = array('.', '..');
- $physicalPath = $this->buildPath($path);
+ $physicalPath = $this->getSourcePath($path);
$logicalPath = $this->mapper->physicalToLogic($physicalPath);
$dh = opendir($physicalPath);
@@ -101,15 +101,15 @@ class MappedLocal extends \OC\Files\Storage\Common {
if (substr($path, -1) == '/') {
$path = substr($path, 0, -1);
}
- return is_dir($this->buildPath($path));
+ return is_dir($this->getSourcePath($path));
}
public function is_file($path) {
- return is_file($this->buildPath($path));
+ return is_file($this->getSourcePath($path));
}
public function stat($path) {
- $fullPath = $this->buildPath($path);
+ $fullPath = $this->getSourcePath($path);
$statResult = stat($fullPath);
if (PHP_INT_SIZE === 4 && !$this->is_dir($path)) {
$filesize = $this->filesize($path);
@@ -120,9 +120,9 @@ class MappedLocal extends \OC\Files\Storage\Common {
}
public function filetype($path) {
- $filetype = filetype($this->buildPath($path));
+ $filetype = filetype($this->getSourcePath($path));
if ($filetype == 'link') {
- $filetype = filetype(realpath($this->buildPath($path)));
+ $filetype = filetype(realpath($this->getSourcePath($path)));
}
return $filetype;
}
@@ -131,7 +131,7 @@ class MappedLocal extends \OC\Files\Storage\Common {
if ($this->is_dir($path)) {
return 0;
}
- $fullPath = $this->buildPath($path);
+ $fullPath = $this->getSourcePath($path);
if (PHP_INT_SIZE === 4) {
$helper = new \OC\LargeFileHelper;
return $helper->getFilesize($fullPath);
@@ -140,19 +140,19 @@ class MappedLocal extends \OC\Files\Storage\Common {
}
public function isReadable($path) {
- return is_readable($this->buildPath($path));
+ return is_readable($this->getSourcePath($path));
}
public function isUpdatable($path) {
- return is_writable($this->buildPath($path));
+ return is_writable($this->getSourcePath($path));
}
public function file_exists($path) {
- return file_exists($this->buildPath($path));
+ return file_exists($this->getSourcePath($path));
}
public function filemtime($path) {
- return filemtime($this->buildPath($path));
+ return filemtime($this->getSourcePath($path));
}
public function touch($path, $mtime = null) {
@@ -160,23 +160,23 @@ class MappedLocal extends \OC\Files\Storage\Common {
// If mtime is nil the current time is set.
// note that the access time of the file always changes to the current time.
if (!is_null($mtime)) {
- $result = touch($this->buildPath($path), $mtime);
+ $result = touch($this->getSourcePath($path), $mtime);
} else {
- $result = touch($this->buildPath($path));
+ $result = touch($this->getSourcePath($path));
}
if ($result) {
- clearstatcache(true, $this->buildPath($path));
+ clearstatcache(true, $this->getSourcePath($path));
}
return $result;
}
public function file_get_contents($path) {
- return file_get_contents($this->buildPath($path));
+ return file_get_contents($this->getSourcePath($path));
}
public function file_put_contents($path, $data) {
- return file_put_contents($this->buildPath($path), $data);
+ return file_put_contents($this->getSourcePath($path), $data);
}
public function unlink($path) {
@@ -208,8 +208,8 @@ class MappedLocal extends \OC\Files\Storage\Common {
$this->unlink($path2);
}
- $physicPath1 = $this->buildPath($path1);
- $physicPath2 = $this->buildPath($path2);
+ $physicPath1 = $this->getSourcePath($path1);
+ $physicPath2 = $this->getSourcePath($path2);
if ($return = rename($physicPath1, $physicPath2)) {
// mapper needs to create copies or all children
$this->copyMapping($path1, $path2);
@@ -237,7 +237,7 @@ class MappedLocal extends \OC\Files\Storage\Common {
closedir($dir);
return true;
} else {
- if ($return = copy($this->buildPath($path1), $this->buildPath($path2))) {
+ if ($return = copy($this->getSourcePath($path1), $this->getSourcePath($path2))) {
$this->copyMapping($path1, $path2);
}
return $return;
@@ -245,7 +245,7 @@ class MappedLocal extends \OC\Files\Storage\Common {
}
public function fopen($path, $mode) {
- return fopen($this->buildPath($path), $mode);
+ return fopen($this->getSourcePath($path), $mode);
}
/**
@@ -256,7 +256,7 @@ class MappedLocal extends \OC\Files\Storage\Common {
private function delTree($dir, $isLogicPath = true) {
$dirRelative = $dir;
if ($isLogicPath) {
- $dir = $this->buildPath($dir);
+ $dir = $this->getSourcePath($dir);
}
if (!file_exists($dir)) {
return true;
@@ -288,11 +288,11 @@ class MappedLocal extends \OC\Files\Storage\Common {
}
public function hash($type, $path, $raw = false) {
- return hash_file($type, $this->buildPath($path), $raw);
+ return hash_file($type, $this->getSourcePath($path), $raw);
}
public function free_space($path) {
- return @disk_free_space($this->buildPath($path));
+ return @disk_free_space($this->getSourcePath($path));
}
public function search($query) {
@@ -300,11 +300,11 @@ class MappedLocal extends \OC\Files\Storage\Common {
}
public function getLocalFile($path) {
- return $this->buildPath($path);
+ return $this->getSourcePath($path);
}
public function getLocalFolder($path) {
- return $this->buildPath($path);
+ return $this->getSourcePath($path);
}
/**
@@ -312,7 +312,7 @@ class MappedLocal extends \OC\Files\Storage\Common {
*/
protected function searchInDir($query, $dir = '') {
$files = array();
- $physicalDir = $this->buildPath($dir);
+ $physicalDir = $this->getSourcePath($dir);
foreach (scandir($physicalDir) as $item) {
if ($item == '.' || $item == '..')
continue;
@@ -341,14 +341,15 @@ class MappedLocal extends \OC\Files\Storage\Common {
}
/**
+ * Get the source path (on disk) of a given path
+ *
* @param string $path
- * @param bool $create
* @return string
*/
- private function buildPath($path, $create = true) {
+ protected function getSourcePath($path) {
$path = $this->stripLeading($path);
$fullPath = $this->datadir . $path;
- return $this->mapper->logicToPhysical($fullPath, $create);
+ return $this->mapper->logicToPhysical($fullPath, true);
}
/**
diff --git a/lib/private/files/storage/wrapper/jail.php b/lib/private/files/storage/wrapper/jail.php
new file mode 100644
index 00000000000..22b96765757
--- /dev/null
+++ b/lib/private/files/storage/wrapper/jail.php
@@ -0,0 +1,413 @@
+<?php
+/**
+ * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Files\Storage\Wrapper;
+
+use OC\Files\Cache\Wrapper\CacheJail;
+
+/**
+ * Jail to a subdirectory of the wrapped storage
+ *
+ * This restricts access to a subfolder of the wrapped storage with the subfolder becoming the root folder new storage
+ */
+class Jail extends Wrapper {
+ /**
+ * @var string
+ */
+ protected $rootPath;
+
+ /**
+ * @param array $arguments ['storage' => $storage, 'mask' => $root]
+ *
+ * $storage: The storage that will be wrapper
+ * $root: The folder in the wrapped storage that will become the root folder of the wrapped storage
+ */
+ public function __construct($arguments) {
+ parent::__construct($arguments);
+ $this->rootPath = $arguments['root'];
+ }
+
+ protected function getSourcePath($path) {
+ if ($path === '') {
+ return $this->rootPath;
+ } else {
+ return $this->rootPath . '/' . $path;
+ }
+ }
+
+ public function getId() {
+ return 'link:' . parent::getId() . ':' . $this->rootPath;
+ }
+
+ /**
+ * see http://php.net/manual/en/function.mkdir.php
+ *
+ * @param string $path
+ * @return bool
+ */
+ public function mkdir($path) {
+ return $this->storage->mkdir($this->getSourcePath($path));
+ }
+
+ /**
+ * see http://php.net/manual/en/function.rmdir.php
+ *
+ * @param string $path
+ * @return bool
+ */
+ public function rmdir($path) {
+ return $this->storage->rmdir($this->getSourcePath($path));
+ }
+
+ /**
+ * see http://php.net/manual/en/function.opendir.php
+ *
+ * @param string $path
+ * @return resource
+ */
+ public function opendir($path) {
+ return $this->storage->opendir($this->getSourcePath($path));
+ }
+
+ /**
+ * see http://php.net/manual/en/function.is_dir.php
+ *
+ * @param string $path
+ * @return bool
+ */
+ public function is_dir($path) {
+ return $this->storage->is_dir($this->getSourcePath($path));
+ }
+
+ /**
+ * see http://php.net/manual/en/function.is_file.php
+ *
+ * @param string $path
+ * @return bool
+ */
+ public function is_file($path) {
+ return $this->storage->is_file($this->getSourcePath($path));
+ }
+
+ /**
+ * see http://php.net/manual/en/function.stat.php
+ * only the following keys are required in the result: size and mtime
+ *
+ * @param string $path
+ * @return array
+ */
+ public function stat($path) {
+ return $this->storage->stat($this->getSourcePath($path));
+ }
+
+ /**
+ * see http://php.net/manual/en/function.filetype.php
+ *
+ * @param string $path
+ * @return bool
+ */
+ public function filetype($path) {
+ return $this->storage->filetype($this->getSourcePath($path));
+ }
+
+ /**
+ * see http://php.net/manual/en/function.filesize.php
+ * The result for filesize when called on a folder is required to be 0
+ *
+ * @param string $path
+ * @return int
+ */
+ public function filesize($path) {
+ return $this->storage->filesize($this->getSourcePath($path));
+ }
+
+ /**
+ * check if a file can be created in $path
+ *
+ * @param string $path
+ * @return bool
+ */
+ public function isCreatable($path) {
+ return $this->storage->isCreatable($this->getSourcePath($path));
+ }
+
+ /**
+ * check if a file can be read
+ *
+ * @param string $path
+ * @return bool
+ */
+ public function isReadable($path) {
+ return $this->storage->isReadable($this->getSourcePath($path));
+ }
+
+ /**
+ * check if a file can be written to
+ *
+ * @param string $path
+ * @return bool
+ */
+ public function isUpdatable($path) {
+ return $this->storage->isUpdatable($this->getSourcePath($path));
+ }
+
+ /**
+ * check if a file can be deleted
+ *
+ * @param string $path
+ * @return bool
+ */
+ public function isDeletable($path) {
+ return $this->storage->isDeletable($this->getSourcePath($path));
+ }
+
+ /**
+ * check if a file can be shared
+ *
+ * @param string $path
+ * @return bool
+ */
+ public function isSharable($path) {
+ return $this->storage->isSharable($this->getSourcePath($path));
+ }
+
+ /**
+ * get the full permissions of a path.
+ * Should return a combination of the PERMISSION_ constants defined in lib/public/constants.php
+ *
+ * @param string $path
+ * @return int
+ */
+ public function getPermissions($path) {
+ return $this->storage->getPermissions($this->getSourcePath($path));
+ }
+
+ /**
+ * see http://php.net/manual/en/function.file_exists.php
+ *
+ * @param string $path
+ * @return bool
+ */
+ public function file_exists($path) {
+ return $this->storage->file_exists($this->getSourcePath($path));
+ }
+
+ /**
+ * see http://php.net/manual/en/function.filemtime.php
+ *
+ * @param string $path
+ * @return int
+ */
+ public function filemtime($path) {
+ return $this->storage->filemtime($this->getSourcePath($path));
+ }
+
+ /**
+ * see http://php.net/manual/en/function.file_get_contents.php
+ *
+ * @param string $path
+ * @return string
+ */
+ public function file_get_contents($path) {
+ return $this->storage->file_get_contents($this->getSourcePath($path));
+ }
+
+ /**
+ * see http://php.net/manual/en/function.file_put_contents.php
+ *
+ * @param string $path
+ * @param string $data
+ * @return bool
+ */
+ public function file_put_contents($path, $data) {
+ return $this->storage->file_put_contents($this->getSourcePath($path), $data);
+ }
+
+ /**
+ * see http://php.net/manual/en/function.unlink.php
+ *
+ * @param string $path
+ * @return bool
+ */
+ public function unlink($path) {
+ return $this->storage->unlink($this->getSourcePath($path));
+ }
+
+ /**
+ * see http://php.net/manual/en/function.rename.php
+ *
+ * @param string $path1
+ * @param string $path2
+ * @return bool
+ */
+ public function rename($path1, $path2) {
+ return $this->storage->rename($this->getSourcePath($path1), $this->getSourcePath($path2));
+ }
+
+ /**
+ * see http://php.net/manual/en/function.copy.php
+ *
+ * @param string $path1
+ * @param string $path2
+ * @return bool
+ */
+ public function copy($path1, $path2) {
+ return $this->storage->copy($this->getSourcePath($path1), $this->getSourcePath($path2));
+ }
+
+ /**
+ * see http://php.net/manual/en/function.fopen.php
+ *
+ * @param string $path
+ * @param string $mode
+ * @return resource
+ */
+ public function fopen($path, $mode) {
+ return $this->storage->fopen($this->getSourcePath($path), $mode);
+ }
+
+ /**
+ * get the mimetype for a file or folder
+ * The mimetype for a folder is required to be "httpd/unix-directory"
+ *
+ * @param string $path
+ * @return string
+ */
+ public function getMimeType($path) {
+ return $this->storage->getMimeType($this->getSourcePath($path));
+ }
+
+ /**
+ * see http://php.net/manual/en/function.hash.php
+ *
+ * @param string $type
+ * @param string $path
+ * @param bool $raw
+ * @return string
+ */
+ public function hash($type, $path, $raw = false) {
+ return $this->storage->hash($type, $this->getSourcePath($path), $raw);
+ }
+
+ /**
+ * see http://php.net/manual/en/function.free_space.php
+ *
+ * @param string $path
+ * @return int
+ */
+ public function free_space($path) {
+ return $this->storage->free_space($this->getSourcePath($path));
+ }
+
+ /**
+ * search for occurrences of $query in file names
+ *
+ * @param string $query
+ * @return array
+ */
+ public function search($query) {
+ return $this->storage->search($query);
+ }
+
+ /**
+ * see http://php.net/manual/en/function.touch.php
+ * If the backend does not support the operation, false should be returned
+ *
+ * @param string $path
+ * @param int $mtime
+ * @return bool
+ */
+ public function touch($path, $mtime = null) {
+ return $this->storage->touch($this->getSourcePath($path), $mtime);
+ }
+
+ /**
+ * get the path to a local version of the file.
+ * The local version of the file can be temporary and doesn't have to be persistent across requests
+ *
+ * @param string $path
+ * @return string
+ */
+ public function getLocalFile($path) {
+ return $this->storage->getLocalFile($this->getSourcePath($path));
+ }
+
+ /**
+ * get the path to a local version of the folder.
+ * The local version of the folder can be temporary and doesn't have to be persistent across requests
+ *
+ * @param string $path
+ * @return string
+ */
+ public function getLocalFolder($path) {
+ return $this->storage->getLocalFolder($this->getSourcePath($path));
+ }
+
+ /**
+ * check if a file or folder has been updated since $time
+ *
+ * @param string $path
+ * @param int $time
+ * @return bool
+ *
+ * hasUpdated for folders should return at least true if a file inside the folder is add, removed or renamed.
+ * returning true for other changes in the folder is optional
+ */
+ public function hasUpdated($path, $time) {
+ return $this->storage->hasUpdated($this->getSourcePath($path), $time);
+ }
+
+ /**
+ * get a cache instance for the storage
+ *
+ * @param string $path
+ * @param \OC\Files\Storage\Storage (optional) the storage to pass to the cache
+ * @return \OC\Files\Cache\Cache
+ */
+ public function getCache($path = '', $storage = null) {
+ if (!$storage) {
+ $storage = $this;
+ }
+ $sourceCache = $this->storage->getCache($this->getSourcePath($path), $storage);
+ return new CacheJail($sourceCache, $this->rootPath);
+ }
+
+ /**
+ * get the user id of the owner of a file or folder
+ *
+ * @param string $path
+ * @return string
+ */
+ public function getOwner($path) {
+ return $this->storage->getOwner($this->getSourcePath($path));
+ }
+
+ /**
+ * get a watcher instance for the cache
+ *
+ * @param string $path
+ * @param \OC\Files\Storage\Storage (optional) the storage to pass to the watcher
+ * @return \OC\Files\Cache\Watcher
+ */
+ public function getWatcher($path = '', $storage = null) {
+ if (!$storage) {
+ $storage = $this;
+ }
+ return $this->storage->getWatcher($this->getSourcePath($path), $storage);
+ }
+
+ /**
+ * get the ETag for a file or folder
+ *
+ * @param string $path
+ * @return string
+ */
+ public function getETag($path) {
+ return $this->storage->getETag($this->getSourcePath($path));
+ }
+}
diff --git a/lib/private/files/storage/wrapper/permissionsmask.php b/lib/private/files/storage/wrapper/permissionsmask.php
new file mode 100644
index 00000000000..955cb54591b
--- /dev/null
+++ b/lib/private/files/storage/wrapper/permissionsmask.php
@@ -0,0 +1,111 @@
+<?php
+/**
+ * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Files\Storage\Wrapper;
+
+use OC\Files\Cache\Wrapper\CachePermissionsMask;
+use OCP\Constants;
+
+/**
+ * Mask the permissions of a storage
+ *
+ * This can be used to restrict update, create, delete and/or share permissions of a storage
+ *
+ * Note that the read permissions cant be masked
+ */
+class PermissionsMask extends Wrapper {
+ /**
+ * @var int the permissions bits we want to keep
+ */
+ private $mask;
+
+ /**
+ * @param array $arguments ['storage' => $storage, 'mask' => $mask]
+ *
+ * $storage: The storage the permissions mask should be applied on
+ * $mask: The permission bits that should be kept, a combination of the \OCP\Constant::PERMISSION_ constants
+ */
+ public function __construct($arguments) {
+ parent::__construct($arguments);
+ $this->mask = $arguments['mask'];
+ }
+
+ private function checkMask($permissions) {
+ return ($this->mask & $permissions) === $permissions;
+ }
+
+ public function isUpdatable($path) {
+ return $this->checkMask(Constants::PERMISSION_UPDATE) and parent::isUpdatable($path);
+ }
+
+ public function isCreatable($path) {
+ return $this->checkMask(Constants::PERMISSION_CREATE) and parent::isCreatable($path);
+ }
+
+ public function isDeletable($path) {
+ return $this->checkMask(Constants::PERMISSION_DELETE) and parent::isDeletable($path);
+ }
+
+ public function getPermissions($path) {
+ return $this->storage->getPermissions($path) & $this->mask;
+ }
+
+ public function rename($path1, $path2) {
+ return $this->checkMask(Constants::PERMISSION_UPDATE) and parent::rename($path1, $path2);
+ }
+
+ public function copy($path1, $path2) {
+ return $this->checkMask(Constants::PERMISSION_CREATE) and parent::copy($path1, $path2);
+ }
+
+ public function touch($path, $mtime = null) {
+ $permissions = $this->file_exists($path) ? Constants::PERMISSION_UPDATE : Constants::PERMISSION_CREATE;
+ return $this->checkMask($permissions) and parent::touch($path, $mtime);
+ }
+
+ public function mkdir($path) {
+ return $this->checkMask(Constants::PERMISSION_CREATE) and parent::mkdir($path);
+ }
+
+ public function rmdir($path) {
+ return $this->checkMask(Constants::PERMISSION_DELETE) and parent::rmdir($path);
+ }
+
+ public function unlink($path) {
+ return $this->checkMask(Constants::PERMISSION_DELETE) and parent::unlink($path);
+ }
+
+ public function file_put_contents($path, $data) {
+ $permissions = $this->file_exists($path) ? Constants::PERMISSION_UPDATE : Constants::PERMISSION_CREATE;
+ return $this->checkMask($permissions) and parent::file_put_contents($path, $data);
+ }
+
+ public function fopen($path, $mode) {
+ if ($mode === 'r' or $mode === 'rb') {
+ return parent::fopen($path, $mode);
+ } else {
+ $permissions = $this->file_exists($path) ? Constants::PERMISSION_UPDATE : Constants::PERMISSION_CREATE;
+ return $this->checkMask($permissions) ? parent::fopen($path, $mode) : false;
+ }
+ }
+
+ /**
+ * get a cache instance for the storage
+ *
+ * @param string $path
+ * @param \OC\Files\Storage\Storage (optional) the storage to pass to the cache
+ * @return \OC\Files\Cache\Cache
+ */
+ public function getCache($path = '', $storage = null) {
+ if (!$storage) {
+ $storage = $this;
+ }
+ $sourceCache = parent::getCache($path, $storage);
+ return new CachePermissionsMask($sourceCache, $this->mask);
+ }
+}
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index 19676524a0e..331ab9ba6cd 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -933,7 +933,7 @@ class View {
}
if ($mount instanceof MoveableMount && $internalPath === '') {
- $data['permissions'] |= \OCP\PERMISSION_DELETE | \OCP\PERMISSION_UPDATE;
+ $data['permissions'] |= \OCP\Constants::PERMISSION_DELETE | \OCP\Constants::PERMISSION_UPDATE;
}
$data = \OC_FileProxy::runPostProxies('getFileInfo', $path, $data);
@@ -988,7 +988,7 @@ class View {
}
// if sharing was disabled for the user we remove the share permissions
if (\OCP\Util::isSharingDisabledForUser()) {
- $content['permissions'] = $content['permissions'] & ~\OCP\PERMISSION_SHARE;
+ $content['permissions'] = $content['permissions'] & ~\OCP\Constants::PERMISSION_SHARE;
}
$files[] = new FileInfo($path . '/' . $content['name'], $storage, $content['path'], $content);
}
@@ -1025,9 +1025,9 @@ class View {
// do not allow renaming/deleting the mount point if they are not shared files/folders
// for shared files/folders we use the permissions given by the owner
if ($mount instanceof MoveableMount) {
- $rootEntry['permissions'] = $permissions | \OCP\PERMISSION_UPDATE | \OCP\PERMISSION_DELETE;
+ $rootEntry['permissions'] = $permissions | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE;
} else {
- $rootEntry['permissions'] = $permissions & (\OCP\PERMISSION_ALL - (\OCP\PERMISSION_UPDATE | \OCP\PERMISSION_DELETE));
+ $rootEntry['permissions'] = $permissions & (\OCP\Constants::PERMISSION_ALL - (\OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE));
}
//remove any existing entry with the same name
@@ -1041,7 +1041,7 @@ class View {
// if sharing was disabled for the user we remove the share permissions
if (\OCP\Util::isSharingDisabledForUser()) {
- $content['permissions'] = $content['permissions'] & ~\OCP\PERMISSION_SHARE;
+ $content['permissions'] = $content['permissions'] & ~\OCP\Constants::PERMISSION_SHARE;
}
$files[] = new FileInfo($path . '/' . $rootEntry['name'], $subStorage, '', $rootEntry);
diff --git a/lib/private/group/backend.php b/lib/private/group/backend.php
index ab694268bb3..9348463a53c 100644
--- a/lib/private/group/backend.php
+++ b/lib/private/group/backend.php
@@ -23,29 +23,51 @@
/**
* error code for functions not provided by the group backend
+ * @deprecated Use \OC_Group_Backend::NOT_IMPLEMENTED instead
*/
define('OC_GROUP_BACKEND_NOT_IMPLEMENTED', -501);
/**
* actions that user backends can define
*/
+/** @deprecated Use \OC_Group_Backend::CREATE_GROUP instead */
define('OC_GROUP_BACKEND_CREATE_GROUP', 0x00000001);
+/** @deprecated Use \OC_Group_Backend::DELETE_GROUP instead */
define('OC_GROUP_BACKEND_DELETE_GROUP', 0x00000010);
+/** @deprecated Use \OC_Group_Backend::ADD_TO_GROUP instead */
define('OC_GROUP_BACKEND_ADD_TO_GROUP', 0x00000100);
+/** @deprecated Use \OC_Group_Backend::REMOVE_FROM_GOUP instead */
define('OC_GROUP_BACKEND_REMOVE_FROM_GOUP', 0x00001000);
+/** @deprecated Obsolete */
define('OC_GROUP_BACKEND_GET_DISPLAYNAME', 0x00010000); //OBSOLETE
+/** @deprecated Use \OC_Group_Backend::COUNT_USERS instead */
define('OC_GROUP_BACKEND_COUNT_USERS', 0x00100000);
/**
* Abstract base class for user management
*/
abstract class OC_Group_Backend implements OC_Group_Interface {
+ /**
+ * error code for functions not provided by the group backend
+ */
+ const NOT_IMPLEMENTED = -501;
+
+ /**
+ * actions that user backends can define
+ */
+ const CREATE_GROUP = 0x00000001;
+ const DELETE_GROUP = 0x00000010;
+ const ADD_TO_GROUP = 0x00000100;
+ const REMOVE_FROM_GOUP = 0x00001000;
+ //OBSOLETE const GET_DISPLAYNAME = 0x00010000;
+ const COUNT_USERS = 0x00100000;
+
protected $possibleActions = array(
- OC_GROUP_BACKEND_CREATE_GROUP => 'createGroup',
- OC_GROUP_BACKEND_DELETE_GROUP => 'deleteGroup',
- OC_GROUP_BACKEND_ADD_TO_GROUP => 'addToGroup',
- OC_GROUP_BACKEND_REMOVE_FROM_GOUP => 'removeFromGroup',
- OC_GROUP_BACKEND_COUNT_USERS => 'countUsersInGroup',
+ self::CREATE_GROUP => 'createGroup',
+ self::DELETE_GROUP => 'deleteGroup',
+ self::ADD_TO_GROUP => 'addToGroup',
+ self::REMOVE_FROM_GOUP => 'removeFromGroup',
+ self::COUNT_USERS => 'countUsersInGroup',
);
/**
diff --git a/lib/private/group/database.php b/lib/private/group/database.php
index 6bad55c8d5e..2069e99599f 100644
--- a/lib/private/group/database.php
+++ b/lib/private/group/database.php
@@ -220,7 +220,7 @@ class OC_Group_Database extends OC_Group_Backend {
* @param string $gid
* @param string $search
* @return int|false
- * @throws DatabaseException
+ * @throws \OC\DatabaseException
*/
public function countUsersInGroup($gid, $search = '') {
$stmt = OC_DB::prepare('SELECT COUNT(`uid`) AS `count` FROM `*PREFIX*group_user` WHERE `gid` = ? AND `uid` LIKE ?');
diff --git a/lib/private/group/group.php b/lib/private/group/group.php
index 6f8b84dff1a..6111051ea09 100644
--- a/lib/private/group/group.php
+++ b/lib/private/group/group.php
@@ -118,7 +118,7 @@ class Group implements IGroup {
$this->emitter->emit('\OC\Group', 'preAddUser', array($this, $user));
}
foreach ($this->backends as $backend) {
- if ($backend->implementsActions(OC_GROUP_BACKEND_ADD_TO_GROUP)) {
+ if ($backend->implementsActions(\OC_Group_Backend::ADD_TO_GROUP)) {
$backend->addToGroup($user->getUID(), $this->gid);
if ($this->users) {
$this->users[$user->getUID()] = $user;
@@ -142,7 +142,7 @@ class Group implements IGroup {
$this->emitter->emit('\OC\Group', 'preRemoveUser', array($this, $user));
}
foreach ($this->backends as $backend) {
- if ($backend->implementsActions(OC_GROUP_BACKEND_REMOVE_FROM_GOUP) and $backend->inGroup($user->getUID(), $this->gid)) {
+ if ($backend->implementsActions(\OC_Group_Backend::REMOVE_FROM_GOUP) and $backend->inGroup($user->getUID(), $this->gid)) {
$backend->removeFromGroup($user->getUID(), $this->gid);
$result = true;
}
@@ -191,7 +191,7 @@ class Group implements IGroup {
public function count($search = '') {
$users = false;
foreach ($this->backends as $backend) {
- if($backend->implementsActions(OC_GROUP_BACKEND_COUNT_USERS)) {
+ if($backend->implementsActions(\OC_Group_Backend::COUNT_USERS)) {
if($users === false) {
//we could directly add to a bool variable, but this would
//be ugly
@@ -234,7 +234,7 @@ class Group implements IGroup {
$this->emitter->emit('\OC\Group', 'preDelete', array($this));
}
foreach ($this->backends as $backend) {
- if ($backend->implementsActions(OC_GROUP_BACKEND_DELETE_GROUP)) {
+ if ($backend->implementsActions(\OC_Group_Backend::DELETE_GROUP)) {
$result = true;
$backend->deleteGroup($this->gid);
}
diff --git a/lib/private/group/interface.php b/lib/private/group/interface.php
index ee5c2d635d6..ee2d718e5dd 100644
--- a/lib/private/group/interface.php
+++ b/lib/private/group/interface.php
@@ -28,7 +28,7 @@ interface OC_Group_Interface {
* @return boolean
*
* Returns the supported actions as int to be
- * compared with OC_GROUP_BACKEND_CREATE_GROUP etc.
+ * compared with \OC_Group_Backend::CREATE_GROUP etc.
*/
public function implementsActions($actions);
diff --git a/lib/private/group/manager.php b/lib/private/group/manager.php
index 417be79ab30..be7bf972693 100644
--- a/lib/private/group/manager.php
+++ b/lib/private/group/manager.php
@@ -134,7 +134,7 @@ class Manager extends PublicEmitter implements IGroupManager {
} else {
$this->emit('\OC\Group', 'preCreate', array($gid));
foreach ($this->backends as $backend) {
- if ($backend->implementsActions(OC_GROUP_BACKEND_CREATE_GROUP)) {
+ if ($backend->implementsActions(\OC_Group_Backend::CREATE_GROUP)) {
$backend->createGroup($gid);
$group = $this->getGroupObject($gid);
$this->emit('\OC\Group', 'postCreate', array($group));
diff --git a/lib/private/helper.php b/lib/private/helper.php
index be448b8ff9b..d43eefcdc52 100644
--- a/lib/private/helper.php
+++ b/lib/private/helper.php
@@ -58,12 +58,11 @@ class OC_Helper {
}
/**
- * @param $key
+ * @param string $key
* @return string url to the online documentation
*/
public static function linkToDocs($key) {
- $theme = new OC_Defaults();
- return $theme->buildDocLinkToKey($key);
+ return OC::$server->getURLGenerator()->linkToDocs($key);
}
/**
diff --git a/lib/private/installer.php b/lib/private/installer.php
index cd1d8ce392f..60ed06ae352 100644
--- a/lib/private/installer.php
+++ b/lib/private/installer.php
@@ -558,8 +558,8 @@ class OC_Installer{
// is the code checker enabled?
if(OC_Config::getValue('appcodechecker', true)) {
// check if grep is installed
- $grep = exec('command -v grep');
- if($grep=='') {
+ $grep = \OC_Helper::findBinaryPath('grep');
+ if (!$grep) {
OC_Log::write('core',
'grep not installed. So checking the code of the app "'.$appname.'" was not possible',
OC_Log::ERROR);
@@ -568,7 +568,7 @@ class OC_Installer{
// iterate the bad patterns
foreach($blacklist as $bl) {
- $cmd = 'grep -ri '.escapeshellarg($bl).' '.$folder.'';
+ $cmd = 'grep --include \\*.php -ri '.escapeshellarg($bl).' '.$folder.'';
$result = exec($cmd);
// bad pattern found
if($result<>'') {
diff --git a/lib/private/l10n.php b/lib/private/l10n.php
index 6ec4e967c7f..bc4e53e975c 100644
--- a/lib/private/l10n.php
+++ b/lib/private/l10n.php
@@ -7,19 +7,9 @@
* @copyright 2012 Frank Karlitschek frank@owncloud.org
* @copyright 2013 Jakob Sack
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
- *
- * You should have received a copy of the GNU Affero General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
*/
/**
@@ -30,6 +20,7 @@ class OC_L10N implements \OCP\IL10N {
* cache
*/
protected static $cache = array();
+ protected static $availableLanguages = array();
/**
* The best language
@@ -89,7 +80,8 @@ class OC_L10N implements \OCP\IL10N {
}
/**
- * @param string $transFile
+ * @param $transFile
+ * @param bool $mergeTranslations
* @return bool
*/
public function load($transFile, $mergeTranslations = false) {
@@ -141,8 +133,8 @@ class OC_L10N implements \OCP\IL10N {
// load the translations file
if($this->load($transFile)) {
//merge with translations from theme
- $theme = OC_Config::getValue( "theme" );
- if (!is_null($theme)) {
+ $theme = \OC::$server->getConfig()->getSystemValue('theme');
+ if (!empty($theme)) {
$transFile = OC::$SERVERROOT.'/themes/'.$theme.substr($transFile, strlen(OC::$SERVERROOT));
if (file_exists($transFile)) {
$this->load($transFile, true);
@@ -285,7 +277,8 @@ class OC_L10N implements \OCP\IL10N {
* Localization
* @param string $type Type of localization
* @param array|int|string $data parameters for this localization
- * @return String or false
+ * @param array $options
+ * @return string|false
*
* Returns the localized data.
*
@@ -393,8 +386,8 @@ class OC_L10N implements \OCP\IL10N {
return self::$language;
}
- if(OC_User::getUser() && OC_Preferences::getValue(OC_User::getUser(), 'core', 'lang')) {
- $lang = OC_Preferences::getValue(OC_User::getUser(), 'core', 'lang');
+ if(OC_User::getUser() && \OC::$server->getConfig()->getUserValue(OC_User::getUser(), 'core', 'lang')) {
+ $lang = \OC::$server->getConfig()->getUserValue(OC_User::getUser(), 'core', 'lang');
self::$language = $lang;
if(is_array($app)) {
$available = $app;
@@ -407,7 +400,7 @@ class OC_L10N implements \OCP\IL10N {
}
}
- $default_language = OC_Config::getValue('default_language', false);
+ $default_language = \OC::$server->getConfig()->getSystemValue('default_language', false);
if($default_language !== false) {
return $default_language;
@@ -457,17 +450,17 @@ class OC_L10N implements \OCP\IL10N {
*/
protected static function findI18nDir($app) {
// find the i18n dir
- $i18ndir = OC::$SERVERROOT.'/core/l10n/';
+ $i18nDir = OC::$SERVERROOT.'/core/l10n/';
if($app != '') {
// Check if the app is in the app folder
if(file_exists(OC_App::getAppPath($app).'/l10n/')) {
- $i18ndir = OC_App::getAppPath($app).'/l10n/';
+ $i18nDir = OC_App::getAppPath($app).'/l10n/';
}
else{
- $i18ndir = OC::$SERVERROOT.'/'.$app.'/l10n/';
+ $i18nDir = OC::$SERVERROOT.'/'.$app.'/l10n/';
}
}
- return $i18ndir;
+ return $i18nDir;
}
/**
@@ -476,6 +469,9 @@ class OC_L10N implements \OCP\IL10N {
* @return array an array of available languages
*/
public static function findAvailableLanguages($app=null) {
+ if(!empty(self::$availableLanguages)) {
+ return self::$availableLanguages;
+ }
$available=array('en');//english is always available
$dir = self::findI18nDir($app);
if(is_dir($dir)) {
@@ -487,6 +483,8 @@ class OC_L10N implements \OCP\IL10N {
}
}
}
+
+ self::$availableLanguages = $available;
return $available;
}
@@ -496,7 +494,7 @@ class OC_L10N implements \OCP\IL10N {
* @return bool
*/
public static function languageExists($app, $lang) {
- if ($lang == 'en') {//english is always available
+ if ($lang === 'en') {//english is always available
return true;
}
$dir = self::findI18nDir($app);
diff --git a/lib/private/migrate.php b/lib/private/migrate.php
deleted file mode 100644
index 8351155aa55..00000000000
--- a/lib/private/migrate.php
+++ /dev/null
@@ -1,626 +0,0 @@
-<?php
-/**
- * ownCloud
- *
- * @author Tom Needham
- * @copyright 2012 Tom Needham tom@owncloud.com
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
- *
- * You should have received a copy of the GNU Affero General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-
-/**
- * provides an interface to migrate users and whole ownclouds
- */
-class OC_Migrate{
-
-
- // Array of OC_Migration_Provider objects
- static private $providers=array();
- // User id of the user to import/export
- static private $uid=false;
- // Holds the ZipArchive object
- static private $zip=false;
- // Stores the type of export
- static private $exporttype=false;
- // Holds the db object
- static private $migration_database=false;
- // Path to the sqlite db
- static private $dbpath=false;
- // Holds the path to the zip file
- static private $zippath=false;
- // Holds the OC_Migration_Content object
- static private $content=false;
-
- /**
- * register a new migration provider
- * @param OC_Migration_Provider $provider
- */
- public static function registerProvider($provider) {
- self::$providers[]=$provider;
- }
-
- /**
- * finds and loads the providers
- */
- static private function findProviders() {
- // Find the providers
- $apps = OC_App::getAllApps();
-
- foreach($apps as $app) {
- $path = OC_App::getAppPath($app) . '/appinfo/migrate.php';
- if( file_exists( $path ) ) {
- include_once $path;
- }
- }
- }
-
- /**
- * exports a user, or owncloud instance
- * @param string $uid user id of user to export if export type is user, defaults to current
- * @param string $type type of export, defualts to user
- * @param string $path path to zip output folder
- * @return string on error, path to zip on success
- */
- public static function export( $uid=null, $type='user', $path=null ) {
- $datadir = OC_Config::getValue( 'datadirectory' );
- // Validate export type
- $types = array( 'user', 'instance', 'system', 'userfiles' );
- if( !in_array( $type, $types ) ) {
- OC_Log::write( 'migration', 'Invalid export type', OC_Log::ERROR );
- return json_encode( array( 'success' => false ) );
- }
- self::$exporttype = $type;
- // Userid?
- if( self::$exporttype == 'user' ) {
- // Check user exists
- self::$uid = is_null($uid) ? OC_User::getUser() : $uid;
- if(!OC_User::userExists(self::$uid)) {
- return json_encode( array( 'success' => false) );
- }
- }
- // Calculate zipname
- if( self::$exporttype == 'user' ) {
- $zipname = 'oc_export_' . self::$uid . '_' . date("y-m-d_H-i-s") . '.zip';
- } else {
- $zipname = 'oc_export_' . self::$exporttype . '_' . date("y-m-d_H-i-s") . '.zip';
- }
- // Calculate path
- if( self::$exporttype == 'user' ) {
- self::$zippath = $datadir . '/' . self::$uid . '/' . $zipname;
- } else {
- if( !is_null( $path ) ) {
- // Validate custom path
- if( !file_exists( $path ) || !is_writeable( $path ) ) {
- OC_Log::write( 'migration', 'Path supplied is invalid.', OC_Log::ERROR );
- return json_encode( array( 'success' => false ) );
- }
- self::$zippath = $path . $zipname;
- } else {
- // Default path
- self::$zippath = get_temp_dir() . '/' . $zipname;
- }
- }
- // Create the zip object
- if( !self::createZip() ) {
- return json_encode( array( 'success' => false ) );
- }
- // Do the export
- self::findProviders();
- $exportdata = array();
- switch( self::$exporttype ) {
- case 'user':
- // Connect to the db
- self::$dbpath = $datadir . '/' . self::$uid . '/migration.db';
- if( !self::connectDB() ) {
- return json_encode( array( 'success' => false ) );
- }
- self::$content = new OC_Migration_Content( self::$zip, self::$migration_database );
- // Export the app info
- $exportdata = self::exportAppData();
- // Add the data dir to the zip
- self::$content->addDir(OC_User::getHome(self::$uid), true, '/' );
- break;
- case 'instance':
- self::$content = new OC_Migration_Content( self::$zip );
- // Creates a zip that is compatable with the import function
- $dbfile = tempnam( get_temp_dir(), "owncloud_export_data_" );
- OC_DB::getDbStructure( $dbfile, 'MDB2_SCHEMA_DUMP_ALL');
-
- // Now add in *dbname* and *dbprefix*
- $dbexport = file_get_contents( $dbfile );
- $dbnamestring = "<database>\n\n <name>" . OC_Config::getValue( "dbname", "owncloud" );
- $dbtableprefixstring = "<table>\n\n <name>" . OC_Config::getValue( "dbtableprefix", "oc_" );
- $dbexport = str_replace( $dbnamestring, "<database>\n\n <name>*dbname*", $dbexport );
- $dbexport = str_replace( $dbtableprefixstring, "<table>\n\n <name>*dbprefix*", $dbexport );
- // Add the export to the zip
- self::$content->addFromString( $dbexport, "dbexport.xml" );
- // Add user data
- foreach(OC_User::getUsers() as $user) {
- self::$content->addDir(OC_User::getHome($user), true, "/userdata/" );
- }
- break;
- case 'userfiles':
- self::$content = new OC_Migration_Content( self::$zip );
- // Creates a zip with all of the users files
- foreach(OC_User::getUsers() as $user) {
- self::$content->addDir(OC_User::getHome($user), true, "/" );
- }
- break;
- case 'system':
- self::$content = new OC_Migration_Content( self::$zip );
- // Creates a zip with the owncloud system files
- self::$content->addDir( OC::$SERVERROOT . '/', false, '/');
- foreach (array(
- ".git",
- "3rdparty",
- "apps",
- "core",
- "files",
- "l10n",
- "lib",
- "ocs",
- "search",
- "settings",
- "tests"
- ) as $dir) {
- self::$content->addDir( OC::$SERVERROOT . '/' . $dir, true, "/");
- }
- break;
- }
- if( !$info = self::getExportInfo( $exportdata ) ) {
- return json_encode( array( 'success' => false ) );
- }
- // Add the export info json to the export zip
- self::$content->addFromString( $info, 'export_info.json' );
- if( !self::$content->finish() ) {
- return json_encode( array( 'success' => false ) );
- }
- return json_encode( array( 'success' => true, 'data' => self::$zippath ) );
- }
-
- /**
- * imports a user, or owncloud instance
- * @param string $path path to zip
- * @param string $type type of import (user or instance)
- * @param string|null|int $uid userid of new user
- * @return string
- */
- public static function import( $path, $type='user', $uid=null ) {
-
- $datadir = OC_Config::getValue( 'datadirectory' );
- // Extract the zip
- if( !$extractpath = self::extractZip( $path ) ) {
- return json_encode( array( 'success' => false ) );
- }
- // Get export_info.json
- $scan = scandir( $extractpath );
- // Check for export_info.json
- if( !in_array( 'export_info.json', $scan ) ) {
- OC_Log::write( 'migration', 'Invalid import file, export_info.json not found', OC_Log::ERROR );
- return json_encode( array( 'success' => false ) );
- }
- $json = json_decode( file_get_contents( $extractpath . 'export_info.json' ) );
- if( $json->exporttype != $type ) {
- OC_Log::write( 'migration', 'Invalid import file', OC_Log::ERROR );
- return json_encode( array( 'success' => false ) );
- }
- self::$exporttype = $type;
-
- $currentuser = OC_User::getUser();
-
- // Have we got a user if type is user
- if( self::$exporttype == 'user' ) {
- self::$uid = !is_null($uid) ? $uid : $currentuser;
- }
-
- // We need to be an admin if we are not importing our own data
- if(($type == 'user' && self::$uid != $currentuser) || $type != 'user' ) {
- if( !OC_User::isAdminUser($currentuser)) {
- // Naughty.
- OC_Log::write( 'migration', 'Import not permitted.', OC_Log::ERROR );
- return json_encode( array( 'success' => false ) );
- }
- }
-
- // Handle export types
- switch( self::$exporttype ) {
- case 'user':
- // Check user availability
- if( !OC_User::userExists( self::$uid ) ) {
- OC_Log::write( 'migration', 'User doesn\'t exist', OC_Log::ERROR );
- return json_encode( array( 'success' => false ) );
- }
-
- // Check if the username is valid
- if( preg_match( '/[^a-zA-Z0-9 _\.@\-]/', $json->exporteduser )) {
- OC_Log::write( 'migration', 'Username is not valid', OC_Log::ERROR );
- return json_encode( array( 'success' => false ) );
- }
-
- // Copy data
- $userfolder = $extractpath . $json->exporteduser;
- $newuserfolder = $datadir . '/' . self::$uid;
- foreach(scandir($userfolder) as $file){
- if($file !== '.' && $file !== '..' && is_dir($userfolder.'/'.$file)) {
- $file = str_replace(array('/', '\\'), '', $file);
-
- // Then copy the folder over
- OC_Helper::copyr($userfolder.'/'.$file, $newuserfolder.'/'.$file);
- }
- }
- // Import user app data
- if(file_exists($extractpath . $json->exporteduser . '/migration.db')) {
- if( !$appsimported = self::importAppData( $extractpath . $json->exporteduser . '/migration.db',
- $json,
- self::$uid ) ) {
- return json_encode( array( 'success' => false ) );
- }
- }
- // All done!
- if( !self::unlink_r( $extractpath ) ) {
- OC_Log::write( 'migration', 'Failed to delete the extracted zip', OC_Log::ERROR );
- }
- return json_encode( array( 'success' => true, 'data' => $appsimported ) );
- break;
- case 'instance':
- /*
- * EXPERIMENTAL
- // Check for new data dir and dbexport before doing anything
- // TODO
-
- // Delete current data folder.
- OC_Log::write( 'migration', "Deleting current data dir", OC_Log::INFO );
- if( !self::unlink_r( $datadir, false ) ) {
- OC_Log::write( 'migration', 'Failed to delete the current data dir', OC_Log::ERROR );
- return json_encode( array( 'success' => false ) );
- }
-
- // Copy over data
- if( !self::copy_r( $extractpath . 'userdata', $datadir ) ) {
- OC_Log::write( 'migration', 'Failed to copy over data directory', OC_Log::ERROR );
- return json_encode( array( 'success' => false ) );
- }
-
- // Import the db
- if( !OC_DB::replaceDB( $extractpath . 'dbexport.xml' ) ) {
- return json_encode( array( 'success' => false ) );
- }
- // Done
- return json_encode( array( 'success' => true ) );
- */
- break;
- }
-
- }
-
- /**
- * recursively deletes a directory
- * @param string $dir path of dir to delete
- * @param bool $deleteRootToo delete the root directory
- * @return bool
- */
- private static function unlink_r( $dir, $deleteRootToo=true ) {
- if( !$dh = @opendir( $dir ) ) {
- return false;
- }
- while (false !== ($obj = readdir($dh))) {
- if($obj == '.' || $obj == '..') {
- continue;
- }
- if (!@unlink($dir . '/' . $obj)) {
- self::unlink_r($dir.'/'.$obj, true);
- }
- }
- closedir($dh);
- if ( $deleteRootToo ) {
- @rmdir($dir);
- }
- return true;
- }
-
- /**
- * tries to extract the import zip
- * @param string $path path to the zip
- * @return string path to extract location (with a trailing slash) or false on failure
- */
- static private function extractZip( $path ) {
- self::$zip = new ZipArchive;
- // Validate path
- if( !file_exists( $path ) ) {
- OC_Log::write( 'migration', 'Zip not found', OC_Log::ERROR );
- return false;
- }
- if ( self::$zip->open( $path ) != true ) {
- OC_Log::write( 'migration', "Failed to open zip file", OC_Log::ERROR );
- return false;
- }
- $to = get_temp_dir() . '/oc_import_' . self::$exporttype . '_' . date("y-m-d_H-i-s") . '/';
- if( !self::$zip->extractTo( $to ) ) {
- return false;
- }
- self::$zip->close();
- return $to;
- }
-
- /**
- * creates a migration.db in the users data dir with their app data in
- * @return bool whether operation was successfull
- */
- private static function exportAppData( ) {
-
- $success = true;
- $return = array();
-
- // Foreach provider
- foreach( self::$providers as $provider ) {
- // Check if the app is enabled
- if( OC_App::isEnabled( $provider->getID() ) ) {
- $success = true;
- // Does this app use the database?
- if( file_exists( OC_App::getAppPath($provider->getID()).'/appinfo/database.xml' ) ) {
- // Create some app tables
- $tables = self::createAppTables( $provider->getID() );
- if( is_array( $tables ) ) {
- // Save the table names
- foreach($tables as $table) {
- $return['apps'][$provider->getID()]['tables'][] = $table;
- }
- } else {
- // It failed to create the tables
- $success = false;
- }
- }
-
- // Run the export function?
- if( $success ) {
- // Set the provider properties
- $provider->setData( self::$uid, self::$content );
- $return['apps'][$provider->getID()]['success'] = $provider->export();
- } else {
- $return['apps'][$provider->getID()]['success'] = false;
- $return['apps'][$provider->getID()]['message'] = 'failed to create the app tables';
- }
-
- // Now add some app info the the return array
- $appinfo = OC_App::getAppInfo( $provider->getID() );
- $return['apps'][$provider->getID()]['version'] = OC_App::getAppVersion($provider->getID());
- }
- }
-
- return $return;
-
- }
-
-
- /**
- * generates json containing export info, and merges any data supplied
- * @param array $array of data to include in the returned json
- * @return string
- */
- static private function getExportInfo( $array=array() ) {
- $info = array(
- 'ocversion' => OC_Util::getVersion(),
- 'exporttime' => time(),
- 'exportedby' => OC_User::getUser(),
- 'exporttype' => self::$exporttype,
- 'exporteduser' => self::$uid
- );
-
- if( !is_array( $array ) ) {
- OC_Log::write( 'migration', 'Supplied $array was not an array in getExportInfo()', OC_Log::ERROR );
- }
- // Merge in other data
- $info = array_merge( $info, (array)$array );
- // Create json
- $json = json_encode( $info );
- return $json;
- }
-
- /**
- * connects to migration.db, or creates if not found
- * @param string $path to migration.db, defaults to user data dir
- * @return bool whether the operation was successful
- */
- static private function connectDB( $path=null ) {
- // Has the dbpath been set?
- self::$dbpath = !is_null( $path ) ? $path : self::$dbpath;
- if( !self::$dbpath ) {
- OC_Log::write( 'migration', 'connectDB() was called without dbpath being set', OC_Log::ERROR );
- return false;
- }
- // Already connected
- if(!self::$migration_database) {
- $datadir = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" );
- $connectionParams = array(
- 'path' => self::$dbpath,
- 'driver' => 'pdo_sqlite',
- );
- $connectionParams['adapter'] = '\OC\DB\AdapterSqlite';
- $connectionParams['wrapperClass'] = 'OC\DB\Connection';
- $connectionParams['tablePrefix'] = '';
-
- // Try to establish connection
- self::$migration_database = \Doctrine\DBAL\DriverManager::getConnection($connectionParams);
- }
- return true;
-
- }
-
- /**
- * creates the tables in migration.db from an apps database.xml
- * @param string $appid id of the app
- * @return bool whether the operation was successful
- */
- static private function createAppTables( $appid ) {
- $schema_manager = new OC\DB\MDB2SchemaManager(self::$migration_database);
-
- // There is a database.xml file
- $content = file_get_contents(OC_App::getAppPath($appid) . '/appinfo/database.xml' );
-
- $file2 = 'static://db_scheme';
- // TODO get the relative path to migration.db from the data dir
- // For now just cheat
- $path = pathinfo( self::$dbpath );
- $content = str_replace( '*dbname*', self::$uid.'/migration', $content );
- $content = str_replace( '*dbprefix*', '', $content );
-
- $xml = new SimpleXMLElement($content);
- foreach($xml->table as $table) {
- $tables[] = (string)$table->name;
- }
-
- file_put_contents( $file2, $content );
-
- // Try to create tables
- try {
- $schema_manager->createDbFromStructure($file2);
- } catch(Exception $e) {
- unlink( $file2 );
- OC_Log::write( 'migration', 'Failed to create tables for: '.$appid, OC_Log::FATAL );
- OC_Log::write( 'migration', $e->getMessage(), OC_Log::FATAL );
- return false;
- }
-
- return $tables;
- }
-
- /**
- * tries to create the zip
- * @return bool
- */
- static private function createZip() {
- self::$zip = new ZipArchive;
- // Check if properties are set
- if( !self::$zippath ) {
- OC_Log::write('migration', 'createZip() called but $zip and/or $zippath have not been set', OC_Log::ERROR);
- return false;
- }
- if ( self::$zip->open( self::$zippath, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE ) !== true ) {
- OC_Log::write('migration',
- 'Failed to create the zip with error: '.self::$zip->getStatusString(),
- OC_Log::ERROR);
- return false;
- } else {
- return true;
- }
- }
-
- /**
- * returns an array of apps that support migration
- * @return array
- */
- static public function getApps() {
- $allapps = OC_App::getAllApps();
- foreach($allapps as $app) {
- $path = self::getAppPath($app) . '/lib/migrate.php';
- if( file_exists( $path ) ) {
- $supportsmigration[] = $app;
- }
- }
- return $supportsmigration;
- }
-
- /**
- * imports a new user
- * @param string $db string path to migration.db
- * @param object $info object of migration info
- * @param string|null|int $uid uid to use
- * @return array an array of apps with import statuses, or false on failure.
- */
- public static function importAppData( $db, $info, $uid=null ) {
- // Check if the db exists
- if( file_exists( $db ) ) {
- // Connect to the db
- if(!self::connectDB( $db )) {
- OC_Log::write('migration', 'Failed to connect to migration.db', OC_Log::ERROR);
- return false;
- }
- } else {
- OC_Log::write('migration', 'Migration.db not found at: '.$db, OC_Log::FATAL );
- return false;
- }
-
- // Find providers
- self::findProviders();
-
- // Generate importinfo array
- $importinfo = array(
- 'olduid' => $info->exporteduser,
- 'newuid' => self::$uid
- );
-
- foreach( self::$providers as $provider) {
- // Is the app in the export?
- $id = $provider->getID();
- if( isset( $info->apps->$id ) ) {
- // Is the app installed
- if( !OC_App::isEnabled( $id ) ) {
- OC_Log::write( 'migration',
- 'App: ' . $id . ' is not installed, can\'t import data.',
- OC_Log::INFO );
- $appsstatus[$id] = 'notsupported';
- } else {
- // Did it succeed on export?
- if( $info->apps->$id->success ) {
- // Give the provider the content object
- if( !self::connectDB( $db ) ) {
- return false;
- }
- $content = new OC_Migration_Content( self::$zip, self::$migration_database );
- $provider->setData( self::$uid, $content, $info );
- // Then do the import
- if( !$appsstatus[$id] = $provider->import( $info->apps->$id, $importinfo ) ) {
- // Failed to import app
- OC_Log::write( 'migration',
- 'Failed to import app data for user: ' . self::$uid . ' for app: ' . $id,
- OC_Log::ERROR );
- }
- } else {
- // Add to failed list
- $appsstatus[$id] = false;
- }
- }
- }
- }
-
- return $appsstatus;
-
- }
-
- /**
- * creates a new user in the database
- * @param string $uid user_id of the user to be created
- * @param string $hash hash of the user to be created
- * @return bool result of user creation
- */
- public static function createUser( $uid, $hash ) {
-
- // Check if userid exists
- if(OC_User::userExists( $uid )) {
- return false;
- }
-
- // Create the user
- $query = OC_DB::prepare( "INSERT INTO `*PREFIX*users` ( `uid`, `password` ) VALUES( ?, ? )" );
- $result = $query->execute( array( $uid, $hash));
- if( !$result ) {
- OC_Log::write('migration', 'Failed to create the new user "'.$uid."", OC_Log::ERROR);
- }
- return $result ? true : false;
-
- }
-
-}
diff --git a/lib/private/migration/content.php b/lib/private/migration/content.php
deleted file mode 100644
index cb5d9ad1472..00000000000
--- a/lib/private/migration/content.php
+++ /dev/null
@@ -1,246 +0,0 @@
-<?php
-/**
- * ownCloud
- *
- * @author Tom Needham
- * @copyright 2012 Tom Needham tom@owncloud.com
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
- *
- * You should have received a copy of the GNU Affero General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-
-/**
- * provides methods to add and access data from the migration
- */
-class OC_Migration_Content{
-
- private $zip=false;
- // Holds the database object
- private $db=null;
- // Holds an array of tmpfiles to delete after zip creation
- private $tmpfiles=array();
-
- /**
- * sets up the
- * @param ZipArchive $zip ZipArchive object
- * @param object $db a database object (required for exporttype user)
- * @return bool|null
- */
- public function __construct( $zip, $db=null ) {
-
- $this->zip = $zip;
- $this->db = $db;
-
- }
-
- /**
- * prepares the db
- * @param string $query the sql query to prepare
- */
- public function prepare( $query ) {
-
- // Only add database to tmpfiles if actually used
- if( !is_null( $this->db ) ) {
- // Get db path
- $db = $this->db->getDatabase();
- if(!in_array($db, $this->tmpfiles)) {
- $this->tmpfiles[] = $db;
- }
- }
-
- // Optimize the query
- $query = $this->processQuery( $query );
-
- // Optimize the query
- $query = $this->db->prepare( $query );
- $query = new OC_DB_StatementWrapper($query, false);
-
- return $query;
- }
-
- /**
- * processes the db query
- * @param string $query the query to process
- * @return string of processed query
- */
- private function processQuery( $query ) {
- $query = str_replace( '`', '\'', $query );
- $query = str_replace( 'NOW()', 'datetime(\'now\')', $query );
- $query = str_replace( 'now()', 'datetime(\'now\')', $query );
- // remove table prefixes
- $query = str_replace( '*PREFIX*', '', $query );
- return $query;
- }
-
- /**
- * copys rows to migration.db from the main database
- * @param array $options array of options.
- * @return bool
- */
- public function copyRows( $options ) {
- if( !array_key_exists( 'table', $options ) ) {
- return false;
- }
-
- $return = array();
-
- // Need to include 'where' in the query?
- if( array_key_exists( 'matchval', $options ) && array_key_exists( 'matchcol', $options ) ) {
-
- // If only one matchval, create an array
- if(!is_array($options['matchval'])) {
- $options['matchval'] = array( $options['matchval'] );
- }
-
- foreach( $options['matchval'] as $matchval ) {
- // Run the query for this match value (where x = y value)
- $sql = 'SELECT * FROM `*PREFIX*' . $options['table'] . '` WHERE `' . $options['matchcol'] . '` = ?';
- $query = OC_DB::prepare( $sql );
- $results = $query->execute( array( $matchval ) );
- $newreturns = $this->insertData( $results, $options );
- $return = array_merge( $return, $newreturns );
- }
-
- } else {
- // Just get everything
- $sql = 'SELECT * FROM `*PREFIX*' . $options['table'] . '`';
- $query = OC_DB::prepare( $sql );
- $results = $query->execute();
- $return = $this->insertData( $results, $options );
-
- }
-
- return $return;
-
- }
-
- /**
- * saves a sql data set into migration.db
- * @param OC_DB_StatementWrapper $data a sql data set returned from self::prepare()->query()
- * @param array $options array of copyRows options
- * @return void
- */
- private function insertData( $data, $options ) {
- $return = array();
- // Foreach row of data to insert
- while( $row = $data->fetchRow() ) {
- // Now save all this to the migration.db
- foreach($row as $field=>$value) {
- $fields[] = $field;
- $values[] = $value;
- }
-
- // Generate some sql
- $sql = "INSERT INTO `" . $options['table'] . '` ( `';
- $fieldssql = implode( '`, `', $fields );
- $sql .= $fieldssql . "` ) VALUES( ";
- $valuessql = substr( str_repeat( '?, ', count( $fields ) ), 0, -2 );
- $sql .= $valuessql . " )";
- // Make the query
- $query = $this->prepare( $sql );
- $query->execute( $values );
- // Do we need to return some values?
- if( array_key_exists( 'idcol', $options ) ) {
- // Yes we do
- $return[] = $row[$options['idcol']];
- } else {
- // Take a guess and return the first field :)
- $return[] = reset($row);
- }
- $fields = '';
- $values = '';
- }
- return $return;
- }
-
- /**
- * adds a directory to the zip object
- * @param boolean|string $dir string path of the directory to add
- * @param bool $recursive
- * @param string $internaldir path of folder to add dir to in zip
- * @return bool
- */
- public function addDir( $dir, $recursive=true, $internaldir='' ) {
- $dirname = basename($dir);
- $this->zip->addEmptyDir($internaldir . $dirname);
- $internaldir.=$dirname.='/';
- if( !file_exists( $dir ) ) {
- return false;
- }
- $dirhandle = opendir($dir);
- if(is_resource($dirhandle)) {
- while (false !== ( $file = readdir($dirhandle))) {
-
- if (( $file != '.' ) && ( $file != '..' )) {
-
- if (is_dir($dir . '/' . $file) && $recursive) {
- $this->addDir($dir . '/' . $file, $recursive, $internaldir);
- } elseif (is_file($dir . '/' . $file)) {
- $this->zip->addFile($dir . '/' . $file, $internaldir . $file);
- }
- }
- }
- closedir($dirhandle);
- } else {
- OC_Log::write('admin_export', "Was not able to open directory: " . $dir, OC_Log::ERROR);
- return false;
- }
- return true;
- }
-
- /**
- * adds a file to the zip from a given string
- * @param string $data string of data to add
- * @param string $path the relative path inside of the zip to save the file to
- * @return bool
- */
- public function addFromString( $data, $path ) {
- // Create a temp file
- $file = tempnam( get_temp_dir(). '/', 'oc_export_tmp_' );
- $this->tmpfiles[] = $file;
- if( !file_put_contents( $file, $data ) ) {
- OC_Log::write( 'migation', 'Failed to save data to a temporary file', OC_Log::ERROR );
- return false;
- }
- // Add file to the zip
- $this->zip->addFile( $file, $path );
- return true;
- }
-
- /**
- * closes the zip, removes temp files
- * @return bool
- */
- public function finish() {
- if( !$this->zip->close() ) {
- OC_Log::write( 'migration',
- 'Failed to write the zip file with error: '.$this->zip->getStatusString(),
- OC_Log::ERROR );
- return false;
- }
- $this->cleanup();
- return true;
- }
-
- /**
- * cleans up after the zip
- */
- private function cleanup() {
- // Delete tmp files
- foreach($this->tmpfiles as $i) {
- unlink( $i );
- }
- }
-}
diff --git a/lib/private/migration/provider.php b/lib/private/migration/provider.php
deleted file mode 100644
index a7c611dcdd4..00000000000
--- a/lib/private/migration/provider.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-/**
- * provides search functionalty
- */
-abstract class OC_Migration_Provider{
-
- protected $id=false;
- protected $content=false;
- protected $uid=false;
- protected $olduid=false;
- protected $appinfo=false;
-
- public function __construct( $appid ) {
- // Set the id
- $this->id = $appid;
- OC_Migrate::registerProvider( $this );
- }
-
- /**
- * exports data for apps
- * @return array appdata to be exported
- */
- abstract function export( );
-
- /**
- * imports data for the app
- * @return void
- */
- abstract function import( );
-
- /**
- * sets the OC_Migration_Content object to $this->content
- * @param OC_Migration_Content $content a OC_Migration_Content object
- */
- public function setData( $uid, $content, $info=null ) {
- $this->content = $content;
- $this->uid = $uid;
- $id = $this->id;
- if( !is_null( $info ) ) {
- $this->olduid = $info->exporteduser;
- $this->appinfo = $info->apps->$id;
- }
- }
-
- /**
- * returns the appid of the provider
- * @return string
- */
- public function getID() {
- return $this->id;
- }
-}
diff --git a/lib/private/naturalsort.php b/lib/private/naturalsort.php
index eb00f99a672..6e259630f79 100644
--- a/lib/private/naturalsort.php
+++ b/lib/private/naturalsort.php
@@ -9,16 +9,6 @@
namespace OC;
-class NaturalSort_DefaultCollator {
-
- public function compare($a, $b) {
- if ($a === $b) {
- return 0;
- }
- return ($a < $b) ? -1 : 1;
- }
-}
-
class NaturalSort {
private static $instance;
private $collator;
@@ -114,4 +104,3 @@ class NaturalSort {
return self::$instance;
}
}
-
diff --git a/lib/private/naturalsort_defaultcollator.php b/lib/private/naturalsort_defaultcollator.php
new file mode 100644
index 00000000000..e1007f8d7b4
--- /dev/null
+++ b/lib/private/naturalsort_defaultcollator.php
@@ -0,0 +1,19 @@
+<?php
+/**
+ * Copyright (c) 2014 Vincent Petry <PVince81@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ *
+ */
+
+namespace OC;
+
+class NaturalSort_DefaultCollator {
+ public function compare($a, $b) {
+ if ($a === $b) {
+ return 0;
+ }
+ return ($a < $b) ? -1 : 1;
+ }
+}
diff --git a/lib/private/preview.php b/lib/private/preview.php
index 778007b21fd..f6c8c485d03 100644
--- a/lib/private/preview.php
+++ b/lib/private/preview.php
@@ -16,14 +16,6 @@ namespace OC;
use OC\Preview\Provider;
use OCP\Files\NotFoundException;
-require_once 'preview/image.php';
-require_once 'preview/movies.php';
-require_once 'preview/mp3.php';
-require_once 'preview/svg.php';
-require_once 'preview/txt.php';
-require_once 'preview/office.php';
-require_once 'preview/bitmap.php';
-
class Preview {
//the thumbnail folder
const THUMBNAILS_FOLDER = 'thumbnails';
@@ -713,7 +705,7 @@ class Preview {
* - OC\Preview\OpenDocument
* - OC\Preview\StarOffice
* - OC\Preview\SVG
- * - OC\Preview\Movies
+ * - OC\Preview\Movie
* - OC\Preview\PDF
* - OC\Preview\TIFF
* - OC\Preview\Illustrator
@@ -744,10 +736,11 @@ class Preview {
return;
}
- if (count(self::$providers) > 0) {
+ if (!empty(self::$providers)) {
return;
}
+ self::registerCoreProviders();
foreach (self::$registeredProviders as $provider) {
$class = $provider['class'];
$options = $provider['options'];
@@ -759,7 +752,74 @@ class Preview {
$keys = array_map('strlen', array_keys(self::$providers));
array_multisort($keys, SORT_DESC, self::$providers);
+ }
+ protected static function registerCoreProviders() {
+ self::registerProvider('OC\Preview\TXT');
+ self::registerProvider('OC\Preview\MarkDown');
+ self::registerProvider('OC\Preview\Image');
+ self::registerProvider('OC\Preview\MP3');
+
+ // SVG, Office and Bitmap require imagick
+ if (extension_loaded('imagick')) {
+ $checkImagick = new \Imagick();
+
+ $imagickProviders = array(
+ 'SVG' => 'OC\Preview\SVG',
+ 'TIFF' => 'OC\Preview\TIFF',
+ 'PDF' => 'OC\Preview\PDF',
+ 'AI' => 'OC\Preview\Illustrator',
+ 'PSD' => 'OC\Preview\Photoshop',
+ // Requires adding 'eps' => array('application/postscript', null), to lib/private/mimetypes.list.php
+ 'EPS' => 'OC\Preview\Postscript',
+ );
+
+ foreach ($imagickProviders as $queryFormat => $provider) {
+ if (count($checkImagick->queryFormats($queryFormat)) === 1) {
+ self::registerProvider($provider);
+ }
+ }
+
+ if (count($checkImagick->queryFormats('PDF')) === 1) {
+ // Office previews are currently not supported on Windows
+ if (!\OC_Util::runningOnWindows() && \OC_Helper::is_function_enabled('shell_exec')) {
+ $officeFound = is_string(\OC::$server->getConfig()->getSystemValue('preview_libreoffice_path', null));
+
+ if (!$officeFound) {
+ //let's see if there is libreoffice or openoffice on this machine
+ $whichLibreOffice = shell_exec('command -v libreoffice');
+ $officeFound = !empty($whichLibreOffice);
+ if (!$officeFound) {
+ $whichOpenOffice = shell_exec('command -v openoffice');
+ $officeFound = !empty($whichOpenOffice);
+ }
+ }
+
+ if ($officeFound) {
+ self::registerProvider('OC\Preview\MSOfficeDoc');
+ self::registerProvider('OC\Preview\MSOffice2003');
+ self::registerProvider('OC\Preview\MSOffice2007');
+ self::registerProvider('OC\Preview\OpenDocument');
+ self::registerProvider('OC\Preview\StarOffice');
+ }
+ }
+ }
+ }
+
+ // Video requires avconv or ffmpeg and is therefor
+ // currently not supported on Windows.
+ if (!\OC_Util::runningOnWindows()) {
+ $avconvBinary = \OC_Helper::findBinaryPath('avconv');
+ $ffmpegBinary = ($avconvBinary) ? null : \OC_Helper::findBinaryPath('ffmpeg');
+
+ if ($avconvBinary || $ffmpegBinary) {
+ // FIXME // a bit hacky but didn't want to use subclasses
+ \OC\Preview\Movie::$avconvBinary = $avconvBinary;
+ \OC\Preview\Movie::$ffmpegBinary = $ffmpegBinary;
+
+ self::registerProvider('OC\Preview\Movie');
+ }
+ }
}
/**
diff --git a/lib/private/preview/bitmap.php b/lib/private/preview/bitmap.php
index 748a63a6afa..25f65cf7fc9 100644
--- a/lib/private/preview/bitmap.php
+++ b/lib/private/preview/bitmap.php
@@ -5,113 +5,33 @@
* later.
* See the COPYING-README file.
*/
-namespace OC\Preview;
-
-use Imagick;
-
-if (extension_loaded('imagick')) {
-
- $checkImagick = new Imagick();
-
- class Bitmap extends Provider {
-
- public function getMimeType() {
- return null;
- }
-
- public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
- $tmpPath = $fileview->toTmpFile($path);
- //create imagick object from bitmap or vector file
- try{
- // Layer 0 contains either the bitmap or
- // a flat representation of all vector layers
- $bp = new Imagick($tmpPath . '[0]');
-
- $bp->setImageFormat('png');
- } catch (\Exception $e) {
- \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR);
- return false;
- }
-
- unlink($tmpPath);
-
- //new bitmap image object
- $image = new \OC_Image($bp);
- //check if image object is valid
- return $image->valid() ? $image : false;
- }
-
- }
-
- if(count($checkImagick->queryFormats('PDF')) === 1) {
-
- //.pdf
- class PDF extends Bitmap {
-
- public function getMimeType() {
- return '/application\/pdf/';
- }
-
- }
-
- \OC\Preview::registerProvider('OC\Preview\PDF');
- }
-
- if(count($checkImagick->queryFormats('TIFF')) === 1) {
-
- //.tiff
- class TIFF extends Bitmap {
-
- public function getMimeType() {
- return '/image\/tiff/';
- }
-
- }
-
- \OC\Preview::registerProvider('OC\Preview\TIFF');
- }
-
- if(count($checkImagick->queryFormats('AI')) === 1) {
-
- //.ai
- class Illustrator extends Bitmap {
-
- public function getMimeType() {
- return '/application\/illustrator/';
- }
-
- }
-
- \OC\Preview::registerProvider('OC\Preview\Illustrator');
- }
-
- // Requires adding 'eps' => array('application/postscript', null), to lib/private/mimetypes.list.php
- if(count($checkImagick->queryFormats('EPS')) === 1) {
-
- //.eps
- class Postscript extends Bitmap {
-
- public function getMimeType() {
- return '/application\/postscript/';
- }
+namespace OC\Preview;
+abstract class Bitmap extends Provider {
+ /**
+ * {@inheritDoc}
+ */
+ public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
+ $tmpPath = $fileview->toTmpFile($path);
+
+ //create imagick object from bitmap or vector file
+ try {
+ // Layer 0 contains either the bitmap or
+ // a flat representation of all vector layers
+ $bp = new \Imagick($tmpPath . '[0]');
+
+ $bp->setImageFormat('png');
+ } catch (\Exception $e) {
+ \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR);
+ return false;
}
- \OC\Preview::registerProvider('OC\Preview\Postscript');
- }
-
- if(count($checkImagick->queryFormats('PSD')) === 1) {
-
- //.psd
- class Photoshop extends Bitmap {
-
- public function getMimeType() {
- return '/application\/x-photoshop/';
- }
+ unlink($tmpPath);
- }
-
- \OC\Preview::registerProvider('OC\Preview\Photoshop');
+ //new bitmap image object
+ $image = new \OC_Image($bp);
+ //check if image object is valid
+ return $image->valid() ? $image : false;
}
}
diff --git a/lib/private/preview/illustrator.php b/lib/private/preview/illustrator.php
new file mode 100644
index 00000000000..e88c305f708
--- /dev/null
+++ b/lib/private/preview/illustrator.php
@@ -0,0 +1,19 @@
+<?php
+/**
+ * Copyright (c) 2013-2014 Georg Ehrke georg@ownCloud.com
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Preview;
+
+//.ai
+class Illustrator extends Bitmap {
+ /**
+ * {@inheritDoc}
+ */
+ public function getMimeType() {
+ return '/application\/illustrator/';
+ }
+}
diff --git a/lib/private/preview/image.php b/lib/private/preview/image.php
index 7bcbddc649e..986a44b48fd 100644
--- a/lib/private/preview/image.php
+++ b/lib/private/preview/image.php
@@ -9,11 +9,16 @@
namespace OC\Preview;
class Image extends Provider {
-
+ /**
+ * {@inheritDoc}
+ */
public function getMimeType() {
return '/image\/(?!tiff$)(?!svg.*).*/';
}
+ /**
+ * {@inheritDoc}
+ */
public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
//get fileinfo
$fileInfo = $fileview->getFileInfo($path);
@@ -35,5 +40,3 @@ class Image extends Provider {
}
}
-
-\OC\Preview::registerProvider('OC\Preview\Image');
diff --git a/lib/private/preview/markdown.php b/lib/private/preview/markdown.php
new file mode 100644
index 00000000000..1be01fcdd4c
--- /dev/null
+++ b/lib/private/preview/markdown.php
@@ -0,0 +1,18 @@
+<?php
+/**
+ * Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+namespace OC\Preview;
+
+class MarkDown extends TXT {
+ /**
+ * {@inheritDoc}
+ */
+ public function getMimeType() {
+ return '/text\/(x-)?markdown/';
+ }
+
+}
diff --git a/lib/private/preview/movie.php b/lib/private/preview/movie.php
new file mode 100644
index 00000000000..06353ddebb7
--- /dev/null
+++ b/lib/private/preview/movie.php
@@ -0,0 +1,94 @@
+<?php
+/**
+ * Copyright (c) 2013 Frank Karlitschek frank@owncloud.org
+ * Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+namespace OC\Preview;
+
+class Movie extends Provider {
+ public static $avconvBinary;
+ public static $ffmpegBinary;
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getMimeType() {
+ return '/video\/.*/';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
+ // TODO: use proc_open() and stream the source file ?
+
+ $fileInfo = $fileview->getFileInfo($path);
+ $useFileDirectly = (!$fileInfo->isEncrypted() && !$fileInfo->isMounted());
+
+ if ($useFileDirectly) {
+ $absPath = $fileview->getLocalFile($path);
+ } else {
+ $absPath = \OC_Helper::tmpFile();
+
+ $handle = $fileview->fopen($path, 'rb');
+
+ // we better use 5MB (1024 * 1024 * 5 = 5242880) instead of 1MB.
+ // in some cases 1MB was no enough to generate thumbnail
+ $firstmb = stream_get_contents($handle, 5242880);
+ file_put_contents($absPath, $firstmb);
+ }
+
+ $result = $this->generateThumbNail($maxX, $maxY, $absPath, 5);
+ if ($result === false) {
+ $result = $this->generateThumbNail($maxX, $maxY, $absPath, 1);
+ if ($result === false) {
+ $result = $this->generateThumbNail($maxX, $maxY, $absPath, 0);
+ }
+ }
+
+ if (!$useFileDirectly) {
+ unlink($absPath);
+ }
+
+ return $result;
+ }
+
+ /**
+ * @param int $maxX
+ * @param int $maxY
+ * @param string $absPath
+ * @param int $second
+ * @return bool|\OC_Image
+ */
+ private function generateThumbNail($maxX, $maxY, $absPath, $second) {
+ $tmpPath = \OC_Helper::tmpFile();
+
+ if (self::$avconvBinary) {
+ $cmd = self::$avconvBinary . ' -an -y -ss ' . escapeshellarg($second) .
+ ' -i ' . escapeshellarg($absPath) .
+ ' -f mjpeg -vframes 1 -vsync 1 ' . escapeshellarg($tmpPath) .
+ ' > /dev/null 2>&1';
+ } else {
+ $cmd = self::$ffmpegBinary . ' -y -ss ' . escapeshellarg($second) .
+ ' -i ' . escapeshellarg($absPath) .
+ ' -f mjpeg -vframes 1' .
+ ' -s ' . escapeshellarg($maxX) . 'x' . escapeshellarg($maxY) .
+ ' ' . escapeshellarg($tmpPath) .
+ ' > /dev/null 2>&1';
+ }
+
+ exec($cmd, $output, $returnCode);
+
+ if ($returnCode === 0) {
+ $image = new \OC_Image();
+ $image->loadFromFile($tmpPath);
+ unlink($tmpPath);
+ return $image->valid() ? $image : false;
+ }
+ unlink($tmpPath);
+ return false;
+ }
+}
diff --git a/lib/private/preview/movies.php b/lib/private/preview/movies.php
deleted file mode 100644
index d69266ceb33..00000000000
--- a/lib/private/preview/movies.php
+++ /dev/null
@@ -1,106 +0,0 @@
-<?php
-/**
- * Copyright (c) 2013 Frank Karlitschek frank@owncloud.org
- * Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
- */
-namespace OC\Preview;
-
-// movie preview is currently not supported on Windows
-if (!\OC_Util::runningOnWindows()) {
- $avconvBinary = \OC_Helper::findBinaryPath('avconv');
- $ffmpegBinary = ($avconvBinary) ? null : \OC_Helper::findBinaryPath('ffmpeg');
-
- if ($avconvBinary || $ffmpegBinary) {
-
- class Movie extends Provider {
- public static $avconvBinary;
- public static $ffmpegBinary;
-
- public function getMimeType() {
- return '/video\/.*/';
- }
-
- public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
- // TODO: use proc_open() and stream the source file ?
-
- $fileInfo = $fileview->getFileInfo($path);
- $useFileDirectly = (!$fileInfo->isEncrypted() && !$fileInfo->isMounted());
-
- if ($useFileDirectly) {
- $absPath = $fileview->getLocalFile($path);
- } else {
- $absPath = \OC_Helper::tmpFile();
-
- $handle = $fileview->fopen($path, 'rb');
-
- // we better use 5MB (1024 * 1024 * 5 = 5242880) instead of 1MB.
- // in some cases 1MB was no enough to generate thumbnail
- $firstmb = stream_get_contents($handle, 5242880);
- file_put_contents($absPath, $firstmb);
- }
-
- $result = $this->generateThumbNail($maxX, $maxY, $absPath, 5);
- if ($result === false) {
- $result = $this->generateThumbNail($maxX, $maxY, $absPath, 1);
- if ($result === false) {
- $result = $this->generateThumbNail($maxX, $maxY, $absPath, 0);
- }
- }
-
- if (!$useFileDirectly) {
- unlink($absPath);
- }
-
- return $result;
- }
-
- /**
- * @param int $maxX
- * @param int $maxY
- * @param string $absPath
- * @param string $tmpPath
- * @param int $second
- * @return bool|\OC_Image
- */
- private function generateThumbNail($maxX, $maxY, $absPath, $second)
- {
- $tmpPath = \OC_Helper::tmpFile();
-
- if (self::$avconvBinary) {
- $cmd = self::$avconvBinary . ' -an -y -ss ' . escapeshellarg($second) .
- ' -i ' . escapeshellarg($absPath) .
- ' -f mjpeg -vframes 1 -vsync 1 ' . escapeshellarg($tmpPath) .
- ' > /dev/null 2>&1';
- } else {
- $cmd = self::$ffmpegBinary . ' -y -ss ' . escapeshellarg($second) .
- ' -i ' . escapeshellarg($absPath) .
- ' -f mjpeg -vframes 1' .
- ' -s ' . escapeshellarg($maxX) . 'x' . escapeshellarg($maxY) .
- ' ' . escapeshellarg($tmpPath) .
- ' > /dev/null 2>&1';
- }
-
- exec($cmd, $output, $returnCode);
-
- if ($returnCode === 0) {
- $image = new \OC_Image();
- $image->loadFromFile($tmpPath);
- unlink($tmpPath);
- return $image->valid() ? $image : false;
- }
- unlink($tmpPath);
- return false;
- }
- }
-
- // a bit hacky but didn't want to use subclasses
- Movie::$avconvBinary = $avconvBinary;
- Movie::$ffmpegBinary = $ffmpegBinary;
-
- \OC\Preview::registerProvider('OC\Preview\Movie');
- }
-}
-
diff --git a/lib/private/preview/mp3.php b/lib/private/preview/mp3.php
index bb4d3dfce86..f1a50d99e13 100644
--- a/lib/private/preview/mp3.php
+++ b/lib/private/preview/mp3.php
@@ -8,11 +8,16 @@
namespace OC\Preview;
class MP3 extends Provider {
-
+ /**
+ * {@inheritDoc}
+ */
public function getMimeType() {
return '/audio\/mpeg/';
}
+ /**
+ * {@inheritDoc}
+ */
public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
$getID3 = new \getID3();
@@ -31,6 +36,12 @@ class MP3 extends Provider {
return $this->getNoCoverThumbnail();
}
+ /**
+ * Generates a default image when the file has no cover
+ *
+ * @return false|\OC_Image False if the default image is missing or invalid,
+ * otherwise the image is returned as \OC_Image
+ */
private function getNoCoverThumbnail() {
$icon = \OC::$SERVERROOT . '/core/img/filetypes/audio.png';
@@ -44,5 +55,3 @@ class MP3 extends Provider {
}
}
-
-\OC\Preview::registerProvider('OC\Preview\MP3');
diff --git a/lib/private/preview/msoffice2003.php b/lib/private/preview/msoffice2003.php
new file mode 100644
index 00000000000..55fbe708435
--- /dev/null
+++ b/lib/private/preview/msoffice2003.php
@@ -0,0 +1,18 @@
+<?php
+/**
+ * Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+namespace OC\Preview;
+
+//.docm, .dotm, .xls(m), .xlt(m), .xla(m), .ppt(m), .pot(m), .pps(m), .ppa(m)
+class MSOffice2003 extends Office {
+ /**
+ * {@inheritDoc}
+ */
+ public function getMimeType() {
+ return '/application\/vnd.ms-.*/';
+ }
+}
diff --git a/lib/private/preview/msoffice2007.php b/lib/private/preview/msoffice2007.php
new file mode 100644
index 00000000000..ace246eb6d9
--- /dev/null
+++ b/lib/private/preview/msoffice2007.php
@@ -0,0 +1,18 @@
+<?php
+/**
+ * Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+namespace OC\Preview;
+
+//.docx, .dotx, .xlsx, .xltx, .pptx, .potx, .ppsx
+class MSOffice2007 extends Office {
+ /**
+ * {@inheritDoc}
+ */
+ public function getMimeType() {
+ return '/application\/vnd.openxmlformats-officedocument.*/';
+ }
+}
diff --git a/lib/private/preview/msofficedoc.php b/lib/private/preview/msofficedoc.php
new file mode 100644
index 00000000000..42507af2233
--- /dev/null
+++ b/lib/private/preview/msofficedoc.php
@@ -0,0 +1,18 @@
+<?php
+/**
+ * Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+namespace OC\Preview;
+
+//.doc, .dot
+class MSOfficeDoc extends Office {
+ /**
+ * {@inheritDoc}
+ */
+ public function getMimeType() {
+ return '/application\/msword/';
+ }
+}
diff --git a/lib/private/preview/office-cl.php b/lib/private/preview/office-cl.php
deleted file mode 100644
index f5c791e37f2..00000000000
--- a/lib/private/preview/office-cl.php
+++ /dev/null
@@ -1,138 +0,0 @@
-<?php
-/**
- * Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
- */
-namespace OC\Preview;
-
-// office preview is currently not supported on Windows
-if (!\OC_Util::runningOnWindows()) {
-
- //we need imagick to convert
- class Office extends Provider {
-
- private $cmd;
-
- public function getMimeType() {
- return null;
- }
-
- public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
- $this->initCmd();
- if(is_null($this->cmd)) {
- return false;
- }
-
- $absPath = $fileview->toTmpFile($path);
-
- $tmpDir = get_temp_dir();
-
- $defaultParameters = ' -env:UserInstallation=file://' . escapeshellarg($tmpDir . '/owncloud-' . \OC_Util::getInstanceId().'/') . ' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to pdf --outdir ';
- $clParameters = \OCP\Config::getSystemValue('preview_office_cl_parameters', $defaultParameters);
-
- $exec = $this->cmd . $clParameters . escapeshellarg($tmpDir) . ' ' . escapeshellarg($absPath);
-
- shell_exec($exec);
-
- //create imagick object from pdf
- try{
- $pdf = new \imagick($absPath . '.pdf' . '[0]');
- $pdf->setImageFormat('jpg');
- } catch (\Exception $e) {
- unlink($absPath);
- unlink($absPath . '.pdf');
- \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR);
- return false;
- }
-
- $image = new \OC_Image();
- $image->loadFromData($pdf);
-
- unlink($absPath);
- unlink($absPath . '.pdf');
-
- return $image->valid() ? $image : false;
- }
-
- private function initCmd() {
- $cmd = '';
-
- if(is_string(\OC_Config::getValue('preview_libreoffice_path', null))) {
- $cmd = \OC_Config::getValue('preview_libreoffice_path', null);
- }
-
- $whichLibreOffice = shell_exec('command -v libreoffice');
- if($cmd === '' && !empty($whichLibreOffice)) {
- $cmd = 'libreoffice';
- }
-
- $whichOpenOffice = shell_exec('command -v openoffice');
- if($cmd === '' && !empty($whichOpenOffice)) {
- $cmd = 'openoffice';
- }
-
- if($cmd === '') {
- $cmd = null;
- }
-
- $this->cmd = $cmd;
- }
- }
-
- //.doc, .dot
- class MSOfficeDoc extends Office {
-
- public function getMimeType() {
- return '/application\/msword/';
- }
-
- }
-
- \OC\Preview::registerProvider('OC\Preview\MSOfficeDoc');
-
- //.docm, .dotm, .xls(m), .xlt(m), .xla(m), .ppt(m), .pot(m), .pps(m), .ppa(m)
- class MSOffice2003 extends Office {
-
- public function getMimeType() {
- return '/application\/vnd.ms-.*/';
- }
-
- }
-
- \OC\Preview::registerProvider('OC\Preview\MSOffice2003');
-
- //.docx, .dotx, .xlsx, .xltx, .pptx, .potx, .ppsx
- class MSOffice2007 extends Office {
-
- public function getMimeType() {
- return '/application\/vnd.openxmlformats-officedocument.*/';
- }
-
- }
-
- \OC\Preview::registerProvider('OC\Preview\MSOffice2007');
-
- //.odt, .ott, .oth, .odm, .odg, .otg, .odp, .otp, .ods, .ots, .odc, .odf, .odb, .odi, .oxt
- class OpenDocument extends Office {
-
- public function getMimeType() {
- return '/application\/vnd.oasis.opendocument.*/';
- }
-
- }
-
- \OC\Preview::registerProvider('OC\Preview\OpenDocument');
-
- //.sxw, .stw, .sxc, .stc, .sxd, .std, .sxi, .sti, .sxg, .sxm
- class StarOffice extends Office {
-
- public function getMimeType() {
- return '/application\/vnd.sun.xml.*/';
- }
-
- }
-
- \OC\Preview::registerProvider('OC\Preview\StarOffice');
-}
diff --git a/lib/private/preview/office.php b/lib/private/preview/office.php
index b47cbc6e08f..5bd61bde3be 100644
--- a/lib/private/preview/office.php
+++ b/lib/private/preview/office.php
@@ -5,24 +5,72 @@
* later.
* See the COPYING-README file.
*/
-//both, libreoffice backend and php fallback, need imagick
-if (extension_loaded('imagick')) {
-
- $checkImagick = new Imagick();
-
- if(count($checkImagick->queryFormats('PDF')) === 1) {
- $isShellExecEnabled = \OC_Helper::is_function_enabled('shell_exec');
-
- // LibreOffice preview is currently not supported on Windows
- if (!\OC_Util::runningOnWindows()) {
- $whichLibreOffice = ($isShellExecEnabled ? shell_exec('command -v libreoffice') : '');
- $isLibreOfficeAvailable = !empty($whichLibreOffice);
- $whichOpenOffice = ($isShellExecEnabled ? shell_exec('command -v openoffice') : '');
- $isOpenOfficeAvailable = !empty($whichOpenOffice);
- //let's see if there is libreoffice or openoffice on this machine
- if($isShellExecEnabled && ($isLibreOfficeAvailable || $isOpenOfficeAvailable || is_string(\OC_Config::getValue('preview_libreoffice_path', null)))) {
- require_once('office-cl.php');
- }
+namespace OC\Preview;
+
+abstract class Office extends Provider {
+ private $cmd;
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
+ $this->initCmd();
+ if(is_null($this->cmd)) {
+ return false;
+ }
+
+ $absPath = $fileview->toTmpFile($path);
+
+ $tmpDir = get_temp_dir();
+
+ $defaultParameters = ' -env:UserInstallation=file://' . escapeshellarg($tmpDir . '/owncloud-' . \OC_Util::getInstanceId().'/') . ' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to pdf --outdir ';
+ $clParameters = \OCP\Config::getSystemValue('preview_office_cl_parameters', $defaultParameters);
+
+ $exec = $this->cmd . $clParameters . escapeshellarg($tmpDir) . ' ' . escapeshellarg($absPath);
+
+ shell_exec($exec);
+
+ //create imagick object from pdf
+ try{
+ $pdf = new \imagick($absPath . '.pdf' . '[0]');
+ $pdf->setImageFormat('jpg');
+ } catch (\Exception $e) {
+ unlink($absPath);
+ unlink($absPath . '.pdf');
+ \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR);
+ return false;
}
+
+ $image = new \OC_Image();
+ $image->loadFromData($pdf);
+
+ unlink($absPath);
+ unlink($absPath . '.pdf');
+
+ return $image->valid() ? $image : false;
+ }
+
+ private function initCmd() {
+ $cmd = '';
+
+ if(is_string(\OC_Config::getValue('preview_libreoffice_path', null))) {
+ $cmd = \OC_Config::getValue('preview_libreoffice_path', null);
+ }
+
+ $whichLibreOffice = shell_exec('command -v libreoffice');
+ if($cmd === '' && !empty($whichLibreOffice)) {
+ $cmd = 'libreoffice';
+ }
+
+ $whichOpenOffice = shell_exec('command -v openoffice');
+ if($cmd === '' && !empty($whichOpenOffice)) {
+ $cmd = 'openoffice';
+ }
+
+ if($cmd === '') {
+ $cmd = null;
+ }
+
+ $this->cmd = $cmd;
}
}
diff --git a/lib/private/preview/opendocument.php b/lib/private/preview/opendocument.php
new file mode 100644
index 00000000000..fe1468ee941
--- /dev/null
+++ b/lib/private/preview/opendocument.php
@@ -0,0 +1,18 @@
+<?php
+/**
+ * Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+namespace OC\Preview;
+
+//.odt, .ott, .oth, .odm, .odg, .otg, .odp, .otp, .ods, .ots, .odc, .odf, .odb, .odi, .oxt
+class OpenDocument extends Office {
+ /**
+ * {@inheritDoc}
+ */
+ public function getMimeType() {
+ return '/application\/vnd.oasis.opendocument.*/';
+ }
+}
diff --git a/lib/private/preview/pdf.php b/lib/private/preview/pdf.php
new file mode 100644
index 00000000000..cb13074ff60
--- /dev/null
+++ b/lib/private/preview/pdf.php
@@ -0,0 +1,19 @@
+<?php
+/**
+ * Copyright (c) 2013-2014 Georg Ehrke georg@ownCloud.com
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Preview;
+
+//.pdf
+class PDF extends Bitmap {
+ /**
+ * {@inheritDoc}
+ */
+ public function getMimeType() {
+ return '/application\/pdf/';
+ }
+}
diff --git a/lib/private/preview/photoshop.php b/lib/private/preview/photoshop.php
new file mode 100644
index 00000000000..f5f60ce4de8
--- /dev/null
+++ b/lib/private/preview/photoshop.php
@@ -0,0 +1,19 @@
+<?php
+/**
+ * Copyright (c) 2013-2014 Georg Ehrke georg@ownCloud.com
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Preview;
+
+//.psd
+class Photoshop extends Bitmap {
+ /**
+ * {@inheritDoc}
+ */
+ public function getMimeType() {
+ return '/application\/x-photoshop/';
+ }
+}
diff --git a/lib/private/preview/postscript.php b/lib/private/preview/postscript.php
new file mode 100644
index 00000000000..7c8b089d92e
--- /dev/null
+++ b/lib/private/preview/postscript.php
@@ -0,0 +1,19 @@
+<?php
+/**
+ * Copyright (c) 2013-2014 Georg Ehrke georg@ownCloud.com
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Preview;
+
+//.eps
+class Postscript extends Bitmap {
+ /**
+ * {@inheritDoc}
+ */
+ public function getMimeType() {
+ return '/application\/postscript/';
+ }
+}
diff --git a/lib/private/preview/provider.php b/lib/private/preview/provider.php
index f544c2c4b13..ead67eaeef7 100644
--- a/lib/private/preview/provider.php
+++ b/lib/private/preview/provider.php
@@ -5,18 +5,21 @@ abstract class Provider {
private $options;
public function __construct($options) {
- $this->options=$options;
+ $this->options = $options;
}
+ /**
+ * @return string Regex with the mimetypes that are supported by this provider
+ */
abstract public function getMimeType();
/**
* Check if a preview can be generated for $path
*
- * @param string $path
+ * @param \OC\Files\FileInfo $file
* @return bool
*/
- public function isAvailable($path) {
+ public function isAvailable($file) {
return true;
}
@@ -26,11 +29,10 @@ abstract class Provider {
* @param int $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image
* @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image
* @param bool $scalingup Disable/Enable upscaling of previews
- * @param object $fileview fileview object of user folder
+ * @param \OC\Files\View $fileview fileview object of user folder
* @return mixed
* false if no preview was generated
* OC_Image object of the preview
*/
abstract public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview);
-
}
diff --git a/lib/private/preview/staroffice.php b/lib/private/preview/staroffice.php
new file mode 100644
index 00000000000..73ad368b341
--- /dev/null
+++ b/lib/private/preview/staroffice.php
@@ -0,0 +1,18 @@
+<?php
+/**
+ * Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+namespace OC\Preview;
+
+//.sxw, .stw, .sxc, .stc, .sxd, .std, .sxi, .sti, .sxg, .sxm
+class StarOffice extends Office {
+ /**
+ * {@inheritDoc}
+ */
+ public function getMimeType() {
+ return '/application\/vnd.sun.xml.*/';
+ }
+}
diff --git a/lib/private/preview/svg.php b/lib/private/preview/svg.php
index 0b5dbc9716f..561e87a6500 100644
--- a/lib/private/preview/svg.php
+++ b/lib/private/preview/svg.php
@@ -7,52 +7,43 @@
*/
namespace OC\Preview;
-use Imagick;
-
-if (extension_loaded('imagick')) {
-
- $checkImagick = new Imagick();
-
- if(count($checkImagick->queryFormats('SVG')) === 1) {
-
- class SVG extends Provider {
+class SVG extends Provider {
+ /**
+ * {@inheritDoc}
+ */
+ public function getMimeType() {
+ return '/image\/svg\+xml/';
+ }
- public function getMimeType() {
- return '/image\/svg\+xml/';
+ /**
+ * {@inheritDoc}
+ */
+ public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
+ try{
+ $svg = new \Imagick();
+ $svg->setBackgroundColor(new \ImagickPixel('transparent'));
+
+ $content = stream_get_contents($fileview->fopen($path, 'r'));
+ if(substr($content, 0, 5) !== '<?xml') {
+ $content = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' . $content;
}
- public function getThumbnail($path,$maxX,$maxY,$scalingup,$fileview) {
- try{
- $svg = new Imagick();
- $svg->setBackgroundColor(new \ImagickPixel('transparent'));
-
- $content = stream_get_contents($fileview->fopen($path, 'r'));
- if(substr($content, 0, 5) !== '<?xml') {
- $content = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' . $content;
- }
-
- // Do not parse SVG files with references
- if(stripos($content, 'xlink:href') !== false) {
- return false;
- }
-
- $svg->readImageBlob($content);
- $svg->setImageFormat('png32');
- } catch (\Exception $e) {
- \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR);
- return false;
- }
-
-
- //new image object
- $image = new \OC_Image();
- $image->loadFromData($svg);
- //check if image object is valid
- return $image->valid() ? $image : false;
+ // Do not parse SVG files with references
+ if(stripos($content, 'xlink:href') !== false) {
+ return false;
}
+ $svg->readImageBlob($content);
+ $svg->setImageFormat('png32');
+ } catch (\Exception $e) {
+ \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR);
+ return false;
}
- \OC\Preview::registerProvider('OC\Preview\SVG');
+ //new image object
+ $image = new \OC_Image();
+ $image->loadFromData($svg);
+ //check if image object is valid
+ return $image->valid() ? $image : false;
}
}
diff --git a/lib/private/preview/tiff.php b/lib/private/preview/tiff.php
new file mode 100644
index 00000000000..0a1e8e8ecec
--- /dev/null
+++ b/lib/private/preview/tiff.php
@@ -0,0 +1,19 @@
+<?php
+/**
+ * Copyright (c) 2013-2014 Georg Ehrke georg@ownCloud.com
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Preview;
+
+//.tiff
+class TIFF extends Bitmap {
+ /**
+ * {@inheritDoc}
+ */
+ public function getMimeType() {
+ return '/image\/tiff/';
+ }
+}
diff --git a/lib/private/preview/txt.php b/lib/private/preview/txt.php
index 7f01b980c0e..8b414dc5726 100644
--- a/lib/private/preview/txt.php
+++ b/lib/private/preview/txt.php
@@ -8,31 +8,24 @@
namespace OC\Preview;
class TXT extends Provider {
-
+ /**
+ * {@inheritDoc}
+ */
public function getMimeType() {
return '/text\/plain/';
}
/**
- * Check if a preview can be generated for $path
- *
- * @param \OC\Files\FileInfo $file
- * @return bool
+ * {@inheritDoc}
*/
public function isAvailable($file) {
return $file->getSize() > 5;
}
/**
- * @param string $path
- * @param int $maxX
- * @param int $maxY
- * @param boolean $scalingup
- * @param \OC\Files\View $fileview
- * @return bool|\OC_Image
+ * {@inheritDoc}
*/
public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
-
$content = $fileview->fopen($path, 'r');
$content = stream_get_contents($content,3000);
@@ -79,15 +72,3 @@ class TXT extends Provider {
return $image->valid() ? $image : false;
}
}
-
-\OC\Preview::registerProvider('OC\Preview\TXT');
-
-class MarkDown extends TXT {
-
- public function getMimeType() {
- return '/text\/(x-)?markdown/';
- }
-
-}
-
-\OC\Preview::registerProvider('OC\Preview\MarkDown');
diff --git a/lib/private/repair.php b/lib/private/repair.php
index b5c1e9db58e..be607b44ed8 100644
--- a/lib/private/repair.php
+++ b/lib/private/repair.php
@@ -101,7 +101,7 @@ class Repair extends BasicEmitter {
//only 7.0.0 through 7.0.2 generated broken previews
$currentVersion = \OC::$server->getConfig()->getSystemValue('version');
if (version_compare($currentVersion, '7.0.0.0', '>=') &&
- version_compare($currentVersion, '7.0.2.2', '<=')) {
+ version_compare($currentVersion, '7.0.3.4', '<=')) {
$steps[] = new \OC\Repair\Preview();
}
diff --git a/lib/private/server.php b/lib/private/server.php
index c413ee8bf6d..7bd7f8ca45d 100644
--- a/lib/private/server.php
+++ b/lib/private/server.php
@@ -29,19 +29,27 @@ use OC\Tagging\TagMapper;
* TODO: hookup all manager classes
*/
class Server extends SimpleContainer implements IServerContainer {
- function __construct() {
+ /** @var string */
+ private $webRoot;
+
+ /**
+ * @param string $webRoot
+ */
+ function __construct($webRoot) {
+ $this->webRoot = $webRoot;
+
$this->registerService('ContactsManager', function ($c) {
return new ContactsManager();
});
- $this->registerService('Request', function ($c) {
+ $this->registerService('Request', function (Server $c) {
if (isset($c['urlParams'])) {
$urlParams = $c['urlParams'];
} else {
$urlParams = array();
}
- if (\OC::$server->getSession()->exists('requesttoken')) {
- $requestToken = \OC::$server->getSession()->get('requesttoken');
+ if ($c->getSession()->exists('requesttoken')) {
+ $requestToken = $c->getSession()->get('requesttoken');
} else {
$requestToken = false;
}
@@ -205,7 +213,7 @@ class Server extends SimpleContainer implements IServerContainer {
$factory = new \OC\DB\ConnectionFactory();
$type = $c->getConfig()->getSystemValue('dbtype', 'sqlite');
if (!$factory->isValidType($type)) {
- throw new \DatabaseException('Invalid database type');
+ throw new \OC\DatabaseException('Invalid database type');
}
$connectionParams = $factory->createConnectionParams($c->getConfig());
$connection = $factory->getConnection($type, $connectionParams);
@@ -233,8 +241,7 @@ class Server extends SimpleContainer implements IServerContainer {
return new NullQueryLogger();
}
});
- $this->registerService('TempManager', function ($c) {
- /** @var Server $c */
+ $this->registerService('TempManager', function (Server $c) {
return new TempManager(get_temp_dir(), $c->getLogger());
});
$this->registerService('AppManager', function(Server $c) {
@@ -631,4 +638,13 @@ class Server extends SimpleContainer implements IServerContainer {
function getAppManager() {
return $this->query('AppManager');
}
+
+ /**
+ * Get the webroot
+ *
+ * @return string
+ */
+ function getWebRoot() {
+ return $this->webRoot;
+ }
}
diff --git a/lib/private/setup.php b/lib/private/setup.php
index 1125933c8e9..1443de18546 100644
--- a/lib/private/setup.php
+++ b/lib/private/setup.php
@@ -8,9 +8,6 @@
use OCP\IConfig;
-class DatabaseSetupException extends \OC\HintException {
-}
-
class OC_Setup {
/** @var IConfig */
protected $config;
@@ -91,7 +88,7 @@ class OC_Setup {
)
);
$configuredDatabases = $this->config->getSystemValue('supportedDatabases',
- array('sqlite', 'mysql', 'pgsql', 'oci', 'mssql'));
+ array('sqlite', 'mysql', 'pgsql'));
if(!is_array($configuredDatabases)) {
throw new Exception('Supported databases are not properly configured.');
}
@@ -195,7 +192,7 @@ class OC_Setup {
try {
$dbSetup->initialize($options);
$dbSetup->setupDatabase($username);
- } catch (DatabaseSetupException $e) {
+ } catch (\OC\DatabaseSetupException $e) {
$error[] = array(
'error' => $e->getMessage(),
'hint' => $e->getHint()
diff --git a/lib/private/setup/mssql.php b/lib/private/setup/mssql.php
index b8329f99079..5143545b76f 100644
--- a/lib/private/setup/mssql.php
+++ b/lib/private/setup/mssql.php
@@ -17,7 +17,7 @@ class MSSQL extends AbstractDatabase {
} else {
$entry = '';
}
- throw new \DatabaseSetupException($this->trans->t('MS SQL username and/or password not valid: %s', array($entry)),
+ throw new \OC\DatabaseSetupException($this->trans->t('MS SQL username and/or password not valid: %s', array($entry)),
$this->trans->t('You need to enter either an existing account or the administrator.'));
}
diff --git a/lib/private/setup/mysql.php b/lib/private/setup/mysql.php
index 5558a2d1e51..8f8d86d388c 100644
--- a/lib/private/setup/mysql.php
+++ b/lib/private/setup/mysql.php
@@ -9,7 +9,7 @@ class MySQL extends AbstractDatabase {
//check if the database user has admin right
$connection = @mysql_connect($this->dbhost, $this->dbuser, $this->dbpassword);
if(!$connection) {
- throw new \DatabaseSetupException($this->trans->t('MySQL/MariaDB username and/or password not valid'),
+ throw new \OC\DatabaseSetupException($this->trans->t('MySQL/MariaDB username and/or password not valid'),
$this->trans->t('You need to enter either an existing account or the administrator.'));
}
//user already specified in config
@@ -96,13 +96,13 @@ class MySQL extends AbstractDatabase {
$query = "CREATE USER '$name'@'localhost' IDENTIFIED BY '$password'";
$result = mysql_query($query, $connection);
if (!$result) {
- throw new \DatabaseSetupException($this->trans->t("MySQL/MariaDB user '%s'@'localhost' exists already.", array($name)),
+ throw new \OC\DatabaseSetupException($this->trans->t("MySQL/MariaDB user '%s'@'localhost' exists already.", array($name)),
$this->trans->t("Drop this user from MySQL/MariaDB", array($name)));
}
$query = "CREATE USER '$name'@'%' IDENTIFIED BY '$password'";
$result = mysql_query($query, $connection);
if (!$result) {
- throw new \DatabaseSetupException($this->trans->t("MySQL/MariaDB user '%s'@'%%' already exists", array($name)),
+ throw new \OC\DatabaseSetupException($this->trans->t("MySQL/MariaDB user '%s'@'%%' already exists", array($name)),
$this->trans->t("Drop this user from MySQL/MariaDB."));
}
}
diff --git a/lib/private/setup/oci.php b/lib/private/setup/oci.php
index 23b5232438a..b75b658bae2 100644
--- a/lib/private/setup/oci.php
+++ b/lib/private/setup/oci.php
@@ -45,14 +45,14 @@ class OCI extends AbstractDatabase {
if(!$connection) {
$errorMessage = $this->getLastError();
if ($errorMessage) {
- throw new \DatabaseSetupException($this->trans->t('Oracle connection could not be established'),
+ throw new \OC\DatabaseSetupException($this->trans->t('Oracle connection could not be established'),
$errorMessage.' Check environment: ORACLE_HOME='.getenv('ORACLE_HOME')
.' ORACLE_SID='.getenv('ORACLE_SID')
.' LD_LIBRARY_PATH='.getenv('LD_LIBRARY_PATH')
.' NLS_LANG='.getenv('NLS_LANG')
.' tnsnames.ora is '.(is_readable(getenv('ORACLE_HOME').'/network/admin/tnsnames.ora')?'':'not ').'readable');
}
- throw new \DatabaseSetupException($this->trans->t('Oracle username and/or password not valid'),
+ throw new \OC\DatabaseSetupException($this->trans->t('Oracle username and/or password not valid'),
'Check environment: ORACLE_HOME='.getenv('ORACLE_HOME')
.' ORACLE_SID='.getenv('ORACLE_SID')
.' LD_LIBRARY_PATH='.getenv('LD_LIBRARY_PATH')
@@ -124,7 +124,7 @@ class OCI extends AbstractDatabase {
}
$connection = @oci_connect($this->dbuser, $this->dbpassword, $easy_connect_string);
if(!$connection) {
- throw new \DatabaseSetupException($this->trans->t('Oracle username and/or password not valid'),
+ throw new \OC\DatabaseSetupException($this->trans->t('Oracle username and/or password not valid'),
$this->trans->t('You need to enter either an existing account or the administrator.'));
}
$query = "SELECT count(*) FROM user_tables WHERE table_name = :un";
diff --git a/lib/private/setup/postgresql.php b/lib/private/setup/postgresql.php
index 4d0c9b52a4d..3777d1620bc 100644
--- a/lib/private/setup/postgresql.php
+++ b/lib/private/setup/postgresql.php
@@ -27,7 +27,7 @@ class PostgreSQL extends AbstractDatabase {
$connection = @pg_connect($connection_string);
if(!$connection)
- throw new \DatabaseSetupException($this->trans->t('PostgreSQL username and/or password not valid'),
+ throw new \OC\DatabaseSetupException($this->trans->t('PostgreSQL username and/or password not valid'),
$this->trans->t('You need to enter either an existing account or the administrator.'));
}
$e_user = pg_escape_string($this->dbuser);
@@ -80,7 +80,7 @@ class PostgreSQL extends AbstractDatabase {
$connection_string = "host='$e_host' dbname='$e_dbname' user='$e_user' port='$port' password='$e_password'";
$connection = @pg_connect($connection_string);
if(!$connection) {
- throw new \DatabaseSetupException($this->trans->t('PostgreSQL username and/or password not valid'),
+ throw new \OC\DatabaseSetupException($this->trans->t('PostgreSQL username and/or password not valid'),
$this->trans->t('You need to enter either an existing account or the administrator.'));
}
$query = "select count(*) FROM pg_class WHERE relname='".$this->tableprefix."users' limit 1";
diff --git a/lib/private/share/helper.php b/lib/private/share/helper.php
index 2418535c9d5..6bbb101db3a 100644
--- a/lib/private/share/helper.php
+++ b/lib/private/share/helper.php
@@ -189,20 +189,23 @@ class Helper extends \OC\Share\Constants {
public static function calculateExpireDate($defaultExpireSettings, $creationTime, $userExpireDate = null) {
$expires = false;
+ $defaultExpires = null;
if (!empty($defaultExpireSettings['defaultExpireDateSet'])) {
- $expires = $creationTime + $defaultExpireSettings['expireAfterDays'] * 86400;
+ $defaultExpires = $creationTime + $defaultExpireSettings['expireAfterDays'] * 86400;
}
if (isset($userExpireDate)) {
// if the admin decided to enforce the default expire date then we only take
// the user defined expire date of it is before the default expire date
- if ($expires && !empty($defaultExpireSettings['enforceExpireDate'])) {
- $expires = min($userExpireDate, $expires);
+ if ($defaultExpires && !empty($defaultExpireSettings['enforceExpireDate'])) {
+ $expires = min($userExpireDate, $defaultExpires);
} else {
$expires = $userExpireDate;
}
+ } else if ($defaultExpires && !empty($defaultExpireSettings['enforceExpireDate'])) {
+ $expires = $defaultExpires;
}
return $expires;
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index 10fff9aeacf..c6fd1604ac7 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -547,7 +547,7 @@ class Share extends \OC\Share\Constants {
// single file shares should never have delete permissions
if ($itemType === 'file') {
- $permissions = (int)$permissions & ~\OCP\PERMISSION_DELETE;
+ $permissions = (int)$permissions & ~\OCP\Constants::PERMISSION_DELETE;
}
// Verify share type and sharing conditions are met
@@ -929,7 +929,7 @@ class Share extends \OC\Share\Constants {
// Check if permissions were removed
if ($item['permissions'] & ~$permissions) {
// If share permission is removed all reshares must be deleted
- if (($item['permissions'] & \OCP\PERMISSION_SHARE) && (~$permissions & \OCP\PERMISSION_SHARE)) {
+ if (($item['permissions'] & \OCP\Constants::PERMISSION_SHARE) && (~$permissions & \OCP\Constants::PERMISSION_SHARE)) {
Helper::delete($item['id'], true);
} else {
$ids = array();
@@ -1458,8 +1458,8 @@ class Share extends \OC\Share\Constants {
}
// Switch ids if sharing permission is granted on only
// one share to ensure correct parent is used if resharing
- if (~(int)$items[$id]['permissions'] & \OCP\PERMISSION_SHARE
- && (int)$row['permissions'] & \OCP\PERMISSION_SHARE) {
+ if (~(int)$items[$id]['permissions'] & \OCP\Constants::PERMISSION_SHARE
+ && (int)$row['permissions'] & \OCP\Constants::PERMISSION_SHARE) {
$items[$row['id']] = $items[$id];
$switchedItems[$id] = $row['id'];
unset($items[$id]);
@@ -1516,7 +1516,7 @@ class Share extends \OC\Share\Constants {
}
// Check if resharing is allowed, if not remove share permission
if (isset($row['permissions']) && (!self::isResharingAllowed() | \OC_Util::isSharingDisabledForUser())) {
- $row['permissions'] &= ~\OCP\PERMISSION_SHARE;
+ $row['permissions'] &= ~\OCP\Constants::PERMISSION_SHARE;
}
// Add display names to result
if ( isset($row['share_with']) && $row['share_with'] != '' &&
@@ -1911,7 +1911,7 @@ class Share extends \OC\Share\Constants {
}
// Check if share permissions is granted
- if (self::isResharingAllowed() && (int)$checkReshare['permissions'] & \OCP\PERMISSION_SHARE) {
+ if (self::isResharingAllowed() && (int)$checkReshare['permissions'] & \OCP\Constants::PERMISSION_SHARE) {
if (~(int)$checkReshare['permissions'] & $permissions) {
$message = 'Sharing %s failed, because the permissions exceed permissions granted to %s';
$message_t = $l->t('Sharing %s failed, because the permissions exceed permissions granted to %s', array($itemSourceName, $uidOwner));
diff --git a/lib/private/urlgenerator.php b/lib/private/urlgenerator.php
index e50e9eed6af..d263d25aeef 100644
--- a/lib/private/urlgenerator.php
+++ b/lib/private/urlgenerator.php
@@ -8,6 +8,7 @@
*/
namespace OC;
+use OC_Defaults;
use OCP\IURLGenerator;
use RuntimeException;
@@ -156,7 +157,7 @@ class URLGenerator implements IURLGenerator {
/**
* Makes an URL absolute
- * @param string $url the url in the owncloud host
+ * @param string $url the url in the ownCloud host
* @return string the absolute version of the url
*/
public function getAbsoluteURL($url) {
@@ -173,4 +174,13 @@ class URLGenerator implements IURLGenerator {
return \OC_Request::serverProtocol() . '://' . \OC_Request::serverHost(). $webRoot . $separator . $url;
}
+
+ /**
+ * @param string $key
+ * @return string url to the online documentation
+ */
+ public function linkToDocs($key) {
+ $theme = new OC_Defaults();
+ return $theme->buildDocLinkToKey($key);
+ }
}
diff --git a/lib/private/user/backend.php b/lib/private/user/backend.php
index 1f0a524117d..5e0eef4771a 100644
--- a/lib/private/user/backend.php
+++ b/lib/private/user/backend.php
@@ -25,19 +25,28 @@
/**
* error code for functions not provided by the user backend
+ * @deprecated Use \OC_User_Backend::NOT_IMPLEMENTED instead
*/
define('OC_USER_BACKEND_NOT_IMPLEMENTED', -501);
/**
* actions that user backends can define
*/
+/** @deprecated Use \OC_User_Backend::CREATE_USER instead */
define('OC_USER_BACKEND_CREATE_USER', 1 << 0);
+/** @deprecated Use \OC_User_Backend::SET_PASSWORD instead */
define('OC_USER_BACKEND_SET_PASSWORD', 1 << 4);
+/** @deprecated Use \OC_User_Backend::CHECK_PASSWORD instead */
define('OC_USER_BACKEND_CHECK_PASSWORD', 1 << 8);
+/** @deprecated Use \OC_User_Backend::GET_HOME instead */
define('OC_USER_BACKEND_GET_HOME', 1 << 12);
+/** @deprecated Use \OC_User_Backend::GET_DISPLAYNAME instead */
define('OC_USER_BACKEND_GET_DISPLAYNAME', 1 << 16);
+/** @deprecated Use \OC_User_Backend::SET_DISPLAYNAME instead */
define('OC_USER_BACKEND_SET_DISPLAYNAME', 1 << 20);
+/** @deprecated Use \OC_User_Backend::PROVIDE_AVATAR instead */
define('OC_USER_BACKEND_PROVIDE_AVATAR', 1 << 24);
+/** @deprecated Use \OC_User_Backend::COUNT_USERS instead */
define('OC_USER_BACKEND_COUNT_USERS', 1 << 28);
/**
@@ -47,16 +56,32 @@ define('OC_USER_BACKEND_COUNT_USERS', 1 << 28);
* Subclass this for your own backends, and see OC_User_Example for descriptions
*/
abstract class OC_User_Backend implements OC_User_Interface {
+ /**
+ * error code for functions not provided by the user backend
+ */
+ const NOT_IMPLEMENTED = -501;
+
+ /**
+ * actions that user backends can define
+ */
+ const CREATE_USER = 1; // 1 << 0
+ const SET_PASSWORD = 16; // 1 << 4
+ const CHECK_PASSWORD = 256; // 1 << 8
+ const GET_HOME = 4096; // 1 << 12
+ const GET_DISPLAYNAME = 65536; // 1 << 16
+ const SET_DISPLAYNAME = 1048576; // 1 << 20
+ const PROVIDE_AVATAR = 16777216; // 1 << 24
+ const COUNT_USERS = 268435456; // 1 << 28
protected $possibleActions = array(
- OC_USER_BACKEND_CREATE_USER => 'createUser',
- OC_USER_BACKEND_SET_PASSWORD => 'setPassword',
- OC_USER_BACKEND_CHECK_PASSWORD => 'checkPassword',
- OC_USER_BACKEND_GET_HOME => 'getHome',
- OC_USER_BACKEND_GET_DISPLAYNAME => 'getDisplayName',
- OC_USER_BACKEND_SET_DISPLAYNAME => 'setDisplayName',
- OC_USER_BACKEND_PROVIDE_AVATAR => 'canChangeAvatar',
- OC_USER_BACKEND_COUNT_USERS => 'countUsers',
+ self::CREATE_USER => 'createUser',
+ self::SET_PASSWORD => 'setPassword',
+ self::CHECK_PASSWORD => 'checkPassword',
+ self::GET_HOME => 'getHome',
+ self::GET_DISPLAYNAME => 'getDisplayName',
+ self::SET_DISPLAYNAME => 'setDisplayName',
+ self::PROVIDE_AVATAR => 'canChangeAvatar',
+ self::COUNT_USERS => 'countUsers',
);
/**
@@ -64,7 +89,7 @@ abstract class OC_User_Backend implements OC_User_Interface {
* @return int bitwise-or'ed actions
*
* Returns the supported actions as int to be
- * compared with OC_USER_BACKEND_CREATE_USER etc.
+ * compared with self::CREATE_USER etc.
*/
public function getSupportedActions() {
$actions = 0;
@@ -83,7 +108,7 @@ abstract class OC_User_Backend implements OC_User_Interface {
* @return boolean
*
* Returns the supported actions as int to be
- * compared with OC_USER_BACKEND_CREATE_USER etc.
+ * compared with self::CREATE_USER etc.
*/
public function implementsActions($actions) {
return (bool)($this->getSupportedActions() & $actions);
diff --git a/lib/private/user/interface.php b/lib/private/user/interface.php
index 4cdc47479a3..624d36e6fe5 100644
--- a/lib/private/user/interface.php
+++ b/lib/private/user/interface.php
@@ -25,11 +25,11 @@ interface OC_User_Interface {
/**
* Check if backend implements actions
- * @param $actions bitwise-or'ed actions
+ * @param int $actions bitwise-or'ed actions
* @return boolean
*
* Returns the supported actions as int to be
- * compared with OC_USER_BACKEND_CREATE_USER etc.
+ * compared with \OC_User_Backend::CREATE_USER etc.
*/
public function implementsActions($actions);
diff --git a/lib/private/user/manager.php b/lib/private/user/manager.php
index 4d1612a35ce..0c01f957bd3 100644
--- a/lib/private/user/manager.php
+++ b/lib/private/user/manager.php
@@ -143,7 +143,7 @@ class Manager extends PublicEmitter implements IUserManager {
*/
public function checkPassword($loginname, $password) {
foreach ($this->backends as $backend) {
- if ($backend->implementsActions(\OC_USER_BACKEND_CHECK_PASSWORD)) {
+ if ($backend->implementsActions(\OC_User_Backend::CHECK_PASSWORD)) {
$uid = $backend->checkPassword($loginname, $password);
if ($uid !== false) {
return $this->getUserObject($uid, $backend);
@@ -246,7 +246,7 @@ class Manager extends PublicEmitter implements IUserManager {
$this->emit('\OC\User', 'preCreateUser', array($uid, $password));
foreach ($this->backends as $backend) {
- if ($backend->implementsActions(\OC_USER_BACKEND_CREATE_USER)) {
+ if ($backend->implementsActions(\OC_User_Backend::CREATE_USER)) {
$backend->createUser($uid, $password);
$user = $this->getUserObject($uid, $backend);
$this->emit('\OC\User', 'postCreateUser', array($user, $password));
@@ -264,7 +264,7 @@ class Manager extends PublicEmitter implements IUserManager {
public function countUsers() {
$userCountStatistics = array();
foreach ($this->backends as $backend) {
- if ($backend->implementsActions(\OC_USER_BACKEND_COUNT_USERS)) {
+ if ($backend->implementsActions(\OC_User_Backend::COUNT_USERS)) {
$backendusers = $backend->countUsers();
if($backendusers !== false) {
if(isset($userCountStatistics[get_class($backend)])) {
diff --git a/lib/private/user/session.php b/lib/private/user/session.php
index ca0265dfb23..94abaca3e76 100644
--- a/lib/private/user/session.php
+++ b/lib/private/user/session.php
@@ -88,15 +88,6 @@ class Session implements IUserSession, Emitter {
* @return \OCP\ISession
*/
public function getSession() {
- // fetch the deprecated \OC::$session if it changed for backwards compatibility
- if (isset(\OC::$session) && \OC::$session !== $this->session) {
- \OC::$server->getLogger()->warning(
- 'One of your installed apps still seems to use the deprecated ' .
- '\OC::$session and has replaced it with a new instance. Please file a bug against it.' .
- 'Closing and replacing session in UserSession instance.'
- );
- $this->setSession(\OC::$session);
- }
return $this->session;
}
@@ -111,14 +102,6 @@ class Session implements IUserSession, Emitter {
}
$this->session = $session;
$this->activeUser = null;
-
- // maintain deprecated \OC::$session
- if (\OC::$session !== $this->session) {
- if (\OC::$session instanceof \OCP\ISession) {
- \OC::$session->close();
- }
- \OC::$session = $session;
- }
}
/**
diff --git a/lib/private/user/user.php b/lib/private/user/user.php
index 729abdc6227..9ad2f5f0d3a 100644
--- a/lib/private/user/user.php
+++ b/lib/private/user/user.php
@@ -90,7 +90,7 @@ class User implements IUser {
public function getDisplayName() {
if (!isset($this->displayName)) {
$displayName = '';
- if ($this->backend and $this->backend->implementsActions(OC_USER_BACKEND_GET_DISPLAYNAME)) {
+ if ($this->backend and $this->backend->implementsActions(\OC_User_Backend::GET_DISPLAYNAME)) {
// get display name and strip whitespace from the beginning and end of it
$backendDisplayName = $this->backend->getDisplayName($this->uid);
if (is_string($backendDisplayName)) {
@@ -115,7 +115,7 @@ class User implements IUser {
*/
public function setDisplayName($displayName) {
$displayName = trim($displayName);
- if ($this->backend->implementsActions(\OC_USER_BACKEND_SET_DISPLAYNAME) && !empty($displayName)) {
+ if ($this->backend->implementsActions(\OC_User_Backend::SET_DISPLAYNAME) && !empty($displayName)) {
$this->displayName = $displayName;
$result = $this->backend->setDisplayName($this->uid, $displayName);
return $result !== false;
@@ -170,7 +170,7 @@ class User implements IUser {
if ($this->emitter) {
$this->emitter->emit('\OC\User', 'preSetPassword', array($this, $password, $recoveryPassword));
}
- if ($this->backend->implementsActions(\OC_USER_BACKEND_SET_PASSWORD)) {
+ if ($this->backend->implementsActions(\OC_User_Backend::SET_PASSWORD)) {
$result = $this->backend->setPassword($this->uid, $password);
if ($this->emitter) {
$this->emitter->emit('\OC\User', 'postSetPassword', array($this, $password, $recoveryPassword));
@@ -188,7 +188,7 @@ class User implements IUser {
*/
public function getHome() {
if (!$this->home) {
- if ($this->backend->implementsActions(\OC_USER_BACKEND_GET_HOME) and $home = $this->backend->getHome($this->uid)) {
+ if ($this->backend->implementsActions(\OC_User_Backend::GET_HOME) and $home = $this->backend->getHome($this->uid)) {
$this->home = $home;
} elseif ($this->config) {
$this->home = $this->config->getSystemValue('datadirectory') . '/' . $this->uid;
@@ -205,7 +205,7 @@ class User implements IUser {
* @return bool
*/
public function canChangeAvatar() {
- if ($this->backend->implementsActions(\OC_USER_BACKEND_PROVIDE_AVATAR)) {
+ if ($this->backend->implementsActions(\OC_User_Backend::PROVIDE_AVATAR)) {
return $this->backend->canChangeAvatar($this->uid);
}
return true;
@@ -217,7 +217,7 @@ class User implements IUser {
* @return bool
*/
public function canChangePassword() {
- return $this->backend->implementsActions(\OC_USER_BACKEND_SET_PASSWORD);
+ return $this->backend->implementsActions(\OC_User_Backend::SET_PASSWORD);
}
/**
@@ -229,7 +229,7 @@ class User implements IUser {
if ($this->config and $this->config->getSystemValue('allow_user_to_change_display_name') === false) {
return false;
} else {
- return $this->backend->implementsActions(\OC_USER_BACKEND_SET_DISPLAYNAME);
+ return $this->backend->implementsActions(\OC_User_Backend::SET_DISPLAYNAME);
}
}
diff --git a/lib/private/util.php b/lib/private/util.php
index 4190f0aa3d8..a18a4e44232 100644
--- a/lib/private/util.php
+++ b/lib/private/util.php
@@ -1336,7 +1336,7 @@ class OC_Util {
return false;
}
foreach (str_split($trimmed) as $char) {
- if (strpos(\OCP\FILENAME_INVALID_CHARS, $char) !== false) {
+ if (strpos(\OCP\Constants::FILENAME_INVALID_CHARS, $char) !== false) {
return false;
}
}
diff --git a/lib/public/activity/iextension.php b/lib/public/activity/iextension.php
index 6bb403a8896..e78ae0043a6 100644
--- a/lib/public/activity/iextension.php
+++ b/lib/public/activity/iextension.php
@@ -30,6 +30,13 @@
namespace OCP\Activity;
interface IExtension {
+
+ const PRIORITY_VERYLOW = 10;
+ const PRIORITY_LOW = 20;
+ const PRIORITY_MEDIUM = 30;
+ const PRIORITY_HIGH = 40;
+ const PRIORITY_VERYHIGH = 50;
+
/**
* The extension can return an array of additional notification types.
* If no additional types are to be added false is to be returned
diff --git a/lib/public/appframework/http/response.php b/lib/public/appframework/http/response.php
index 354911fee21..67e72cff6d9 100644
--- a/lib/public/appframework/http/response.php
+++ b/lib/public/appframework/http/response.php
@@ -46,8 +46,15 @@ class Response {
/**
+ * Cookies that will be need to be constructed as header
+ * @var array
+ */
+ private $cookies = array();
+
+
+ /**
* HTTP status code - defaults to STATUS OK
- * @var string
+ * @var int
*/
private $status = Http::STATUS_OK;
@@ -70,6 +77,7 @@ class Response {
* Caches the response
* @param int $cacheSeconds the amount of seconds that should be cached
* if 0 then caching will be disabled
+ * @return $this
*/
public function cacheFor($cacheSeconds) {
@@ -83,13 +91,68 @@ class Response {
return $this;
}
+ /**
+ * Adds a new cookie to the response
+ * @param string $name The name of the cookie
+ * @param string $value The value of the cookie
+ * @param \DateTime|null $expireDate Date on that the cookie should expire, if set
+ * to null cookie will be considered as session
+ * cookie.
+ * @return $this
+ */
+ public function addCookie($name, $value, \DateTime $expireDate = null) {
+ $this->cookies[$name] = array('value' => $value, 'expireDate' => $expireDate);
+ return $this;
+ }
+
+
+ /**
+ * Set the specified cookies
+ * @param array $cookies array('foo' => array('value' => 'bar', 'expire' => null))
+ * @return $this
+ */
+ public function setCookies(array $cookies) {
+ $this->cookies = $cookies;
+ return $this;
+ }
+
+
+ /**
+ * Invalidates the specified cookie
+ * @param string $name
+ * @return $this
+ */
+ public function invalidateCookie($name) {
+ $this->addCookie($name, 'expired', new \DateTime('1971-01-01 00:00'));
+ return $this;
+ }
+
+ /**
+ * Invalidates the specified cookies
+ * @param array $cookieNames array('foo', 'bar')
+ * @return $this
+ */
+ public function invalidateCookies(array $cookieNames) {
+ foreach($cookieNames as $cookieName) {
+ $this->invalidateCookie($cookieName);
+ }
+ return $this;
+ }
+
+ /**
+ * Returns the cookies
+ * @return array
+ */
+ public function getCookies() {
+ return $this->cookies;
+ }
/**
* Adds a new header to the response that will be called before the render
* function
* @param string $name The name of the HTTP header
* @param string $value The value, null will delete it
- * @return Response Reference to this object
+ * @return $this
*/
public function addHeader($name, $value) {
$name = trim($name); // always remove leading and trailing whitespace
@@ -108,10 +171,10 @@ class Response {
/**
* Set the headers
- * @param array key value header pairs
- * @return Response Reference to this object
+ * @param array $headers value header pairs
+ * @return $this
*/
- public function setHeaders($headers) {
+ public function setHeaders(array $headers) {
$this->headers = $headers;
return $this;
diff --git a/lib/public/constants.php b/lib/public/constants.php
index 350646a0ac0..78cafd11847 100644
--- a/lib/public/constants.php
+++ b/lib/public/constants.php
@@ -26,15 +26,37 @@
namespace OCP;
-/**
- * CRUDS permissions.
- */
+/** @deprecated Use \OCP\Constants::PERMISSION_CREATE instead */
const PERMISSION_CREATE = 4;
+
+/** @deprecated Use \OCP\Constants::PERMISSION_READ instead */
const PERMISSION_READ = 1;
+
+/** @deprecated Use \OCP\Constants::PERMISSION_UPDATE instead */
const PERMISSION_UPDATE = 2;
+
+/** @deprecated Use \OCP\Constants::PERMISSION_DELETE instead */
const PERMISSION_DELETE = 8;
+
+/** @deprecated Use \OCP\Constants::PERMISSION_SHARE instead */
const PERMISSION_SHARE = 16;
+
+/** @deprecated Use \OCP\Constants::PERMISSION_ALL instead */
const PERMISSION_ALL = 31;
+/** @deprecated Use \OCP\Constants::FILENAME_INVALID_CHARS instead */
const FILENAME_INVALID_CHARS = "\\/<>:\"|?*\n";
+class Constants {
+ /**
+ * CRUDS permissions.
+ */
+ const PERMISSION_CREATE = 4;
+ const PERMISSION_READ = 1;
+ const PERMISSION_UPDATE = 2;
+ const PERMISSION_DELETE = 8;
+ const PERMISSION_SHARE = 16;
+ const PERMISSION_ALL = 31;
+
+ const FILENAME_INVALID_CHARS = "\\/<>:\"|?*\n";
+}
diff --git a/lib/public/files/fileinfo.php b/lib/public/files/fileinfo.php
index ec81a541564..3a407ed67ca 100644
--- a/lib/public/files/fileinfo.php
+++ b/lib/public/files/fileinfo.php
@@ -103,12 +103,12 @@ interface FileInfo {
/**
* Get the permissions of the file or folder as bitmasked combination of the following constants
- * \OCP\PERMISSION_CREATE
- * \OCP\PERMISSION_READ
- * \OCP\PERMISSION_UPDATE
- * \OCP\PERMISSION_DELETE
- * \OCP\PERMISSION_SHARE
- * \OCP\PERMISSION_ALL
+ * \OCP\Constants::PERMISSION_CREATE
+ * \OCP\Constants::PERMISSION_READ
+ * \OCP\Constants::PERMISSION_UPDATE
+ * \OCP\Constants::PERMISSION_DELETE
+ * \OCP\Constants::PERMISSION_SHARE
+ * \OCP\Constants::PERMISSION_ALL
*
* @return int
*/
diff --git a/lib/public/files/ihomestorage.php b/lib/public/files/ihomestorage.php
new file mode 100644
index 00000000000..717ef946750
--- /dev/null
+++ b/lib/public/files/ihomestorage.php
@@ -0,0 +1,24 @@
+<?php
+/**
+ * ownCloud
+ *
+ * @author Robin Appelman
+ * @copyright 2012 Robin Appelman icewind@owncloud.com
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+/**
+ * Public interface of ownCloud for apps to use.
+ * Files/Storage interface
+ */
+
+// use OCP namespace for all classes that are considered public.
+// This means that they should be used by apps instead of the internal ownCloud classes
+namespace OCP\Files;
+
+interface IHomeStorage {
+
+}
diff --git a/lib/public/files/node.php b/lib/public/files/node.php
index a380394095b..35c20b487c9 100644
--- a/lib/public/files/node.php
+++ b/lib/public/files/node.php
@@ -128,11 +128,11 @@ interface Node {
/**
* Get the permissions of the file or folder as a combination of one or more of the following constants:
- * - \OCP\PERMISSION_READ
- * - \OCP\PERMISSION_UPDATE
- * - \OCP\PERMISSION_CREATE
- * - \OCP\PERMISSION_DELETE
- * - \OCP\PERMISSION_SHARE
+ * - \OCP\Constants::PERMISSION_READ
+ * - \OCP\Constants::PERMISSION_UPDATE
+ * - \OCP\Constants::PERMISSION_CREATE
+ * - \OCP\Constants::PERMISSION_DELETE
+ * - \OCP\Constants::PERMISSION_SHARE
*
* @return int
*/
diff --git a/lib/public/files/storage.php b/lib/public/files/storage.php
index 8f8d7852ee4..323d20db564 100644
--- a/lib/public/files/storage.php
+++ b/lib/public/files/storage.php
@@ -336,7 +336,3 @@ interface Storage {
*/
public function instanceOfStorage($class);
}
-
-interface IHomeStorage {
-
-}
diff --git a/lib/public/iavatar.php b/lib/public/iavatar.php
index 1e80682c4f7..213d2e6cef5 100644
--- a/lib/public/iavatar.php
+++ b/lib/public/iavatar.php
@@ -23,9 +23,9 @@ interface IAvatar {
/**
* sets the users avatar
* @param Image $data mixed imagedata or path to set a new avatar
- * @throws Exception if the provided file is not a jpg or png image
- * @throws Exception if the provided image is not valid
- * @throws \OCP\NotSquareException if the image is not square
+ * @throws \Exception if the provided file is not a jpg or png image
+ * @throws \Exception if the provided image is not valid
+ * @throws \OC\NotSquareException if the image is not square
* @return void
*/
function set($data);
diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php
index b734d1b4161..301f47c68fa 100644
--- a/lib/public/iservercontainer.php
+++ b/lib/public/iservercontainer.php
@@ -298,4 +298,11 @@ interface IServerContainer {
* @return \OCP\App\IAppManager
*/
function getAppManager();
+
+ /**
+ * Get the webroot
+ *
+ * @return string
+ */
+ function getWebRoot();
}
diff --git a/lib/public/iurlgenerator.php b/lib/public/iurlgenerator.php
index dbbd8a3bb63..fa817c10ea5 100644
--- a/lib/public/iurlgenerator.php
+++ b/lib/public/iurlgenerator.php
@@ -69,8 +69,14 @@ interface IURLGenerator {
/**
* Makes an URL absolute
- * @param string $url the url in the owncloud host
+ * @param string $url the url in the ownCloud host
* @return string the absolute version of the url
*/
public function getAbsoluteURL($url);
+
+ /**
+ * @param string $key
+ * @return string url to the online documentation
+ */
+ public function linkToDocs($key);
}
diff --git a/lib/public/share.php b/lib/public/share.php
index 333e0a26970..b3ece8fab94 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -342,86 +342,3 @@ class Share extends \OC\Share\Constants {
return \OC\Share\Share::isResharingAllowed();
}
}
-
-/**
- * Interface that apps must implement to share content.
- */
-interface Share_Backend {
-
- /**
- * Check if this $itemSource exist for the user
- * @param string $itemSource
- * @param string $uidOwner Owner of the item
- * @return boolean|null Source
- *
- * Return false if the item does not exist for the user
- */
- public function isValidSource($itemSource, $uidOwner);
-
- /**
- * Get a unique name of the item for the specified user
- * @param string $itemSource
- * @param string|false $shareWith User the item is being shared with
- * @param array|null $exclude List of similar item names already existing as shared items @deprecated since version OC7
- * @return string Target name
- *
- * This function needs to verify that the user does not already have an item with this name.
- * If it does generate a new name e.g. name_#
- */
- public function generateTarget($itemSource, $shareWith, $exclude = null);
-
- /**
- * Converts the shared item sources back into the item in the specified format
- * @param array $items Shared items
- * @param int $format
- * @return TODO
- *
- * The items array is a 3-dimensional array with the item_source as the
- * first key and the share id as the second key to an array with the share
- * info.
- *
- * The key/value pairs included in the share info depend on the function originally called:
- * If called by getItem(s)Shared: id, item_type, item, item_source,
- * share_type, share_with, permissions, stime, file_source
- *
- * If called by getItem(s)SharedWith: id, item_type, item, item_source,
- * item_target, share_type, share_with, permissions, stime, file_source,
- * file_target
- *
- * This function allows the backend to control the output of shared items with custom formats.
- * It is only called through calls to the public getItem(s)Shared(With) functions.
- */
- public function formatItems($items, $format, $parameters = null);
-
-}
-
-/**
- * Interface for share backends that share content that is dependent on files.
- * Extends the Share_Backend interface.
- */
-interface Share_Backend_File_Dependent extends Share_Backend {
-
- /**
- * Get the file path of the item
- * @param string $itemSource
- * @param string $uidOwner User that is the owner of shared item
- * @return string|false
- */
- public function getFilePath($itemSource, $uidOwner);
-
-}
-
-/**
- * Interface for collections of of items implemented by another share backend.
- * Extends the Share_Backend interface.
- */
-interface Share_Backend_Collection extends Share_Backend {
-
- /**
- * Get the sources of the children of the item
- * @param string $itemSource
- * @return array Returns an array of children each inside an array with the keys: source, target, and file_path if applicable
- */
- public function getChildren($itemSource);
-
-}
diff --git a/lib/public/share_backend.php b/lib/public/share_backend.php
new file mode 100644
index 00000000000..6ab234aecf0
--- /dev/null
+++ b/lib/public/share_backend.php
@@ -0,0 +1,68 @@
+<?php
+/**
+ * ownCloud
+ *
+ * @author Bjoern Schiessle, Michael Gapczynski
+ * @copyright 2012 Michael Gapczynski <mtgap@owncloud.com>
+ * 2014 Bjoern Schiessle <schiessle@owncloud.com>
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+// use OCP namespace for all classes that are considered public.
+// This means that they should be used by apps instead of the internal ownCloud classes
+namespace OCP;
+
+/**
+ * Interface that apps must implement to share content.
+ */
+interface Share_Backend {
+
+ /**
+ * Check if this $itemSource exist for the user
+ * @param string $itemSource
+ * @param string $uidOwner Owner of the item
+ * @return boolean|null Source
+ *
+ * Return false if the item does not exist for the user
+ */
+ public function isValidSource($itemSource, $uidOwner);
+
+ /**
+ * Get a unique name of the item for the specified user
+ * @param string $itemSource
+ * @param string|false $shareWith User the item is being shared with
+ * @param array|null $exclude List of similar item names already existing as shared items @deprecated since version OC7
+ * @return string Target name
+ *
+ * This function needs to verify that the user does not already have an item with this name.
+ * If it does generate a new name e.g. name_#
+ */
+ public function generateTarget($itemSource, $shareWith, $exclude = null);
+
+ /**
+ * Converts the shared item sources back into the item in the specified format
+ * @param array $items Shared items
+ * @param int $format
+ * @return TODO
+ *
+ * The items array is a 3-dimensional array with the item_source as the
+ * first key and the share id as the second key to an array with the share
+ * info.
+ *
+ * The key/value pairs included in the share info depend on the function originally called:
+ * If called by getItem(s)Shared: id, item_type, item, item_source,
+ * share_type, share_with, permissions, stime, file_source
+ *
+ * If called by getItem(s)SharedWith: id, item_type, item, item_source,
+ * item_target, share_type, share_with, permissions, stime, file_source,
+ * file_target
+ *
+ * This function allows the backend to control the output of shared items with custom formats.
+ * It is only called through calls to the public getItem(s)Shared(With) functions.
+ */
+ public function formatItems($items, $format, $parameters = null);
+
+}
diff --git a/lib/public/share_backend_collection.php b/lib/public/share_backend_collection.php
new file mode 100644
index 00000000000..0292222c74f
--- /dev/null
+++ b/lib/public/share_backend_collection.php
@@ -0,0 +1,29 @@
+<?php
+/**
+ * ownCloud
+ *
+ * @author Bjoern Schiessle, Michael Gapczynski
+ * @copyright 2012 Michael Gapczynski <mtgap@owncloud.com>
+ * 2014 Bjoern Schiessle <schiessle@owncloud.com>
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+// use OCP namespace for all classes that are considered public.
+// This means that they should be used by apps instead of the internal ownCloud classes
+namespace OCP;
+
+/**
+ * Interface for collections of of items implemented by another share backend.
+ * Extends the Share_Backend interface.
+ */
+interface Share_Backend_Collection extends Share_Backend {
+ /**
+ * Get the sources of the children of the item
+ * @param string $itemSource
+ * @return array Returns an array of children each inside an array with the keys: source, target, and file_path if applicable
+ */
+ public function getChildren($itemSource);
+}
diff --git a/lib/public/share_backend_file_dependent.php b/lib/public/share_backend_file_dependent.php
new file mode 100644
index 00000000000..b666e504008
--- /dev/null
+++ b/lib/public/share_backend_file_dependent.php
@@ -0,0 +1,31 @@
+<?php
+/**
+ * ownCloud
+ *
+ * @author Bjoern Schiessle, Michael Gapczynski
+ * @copyright 2012 Michael Gapczynski <mtgap@owncloud.com>
+ * 2014 Bjoern Schiessle <schiessle@owncloud.com>
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+// use OCP namespace for all classes that are considered public.
+// This means that they should be used by apps instead of the internal ownCloud classes
+namespace OCP;
+
+/**
+ * Interface for share backends that share content that is dependent on files.
+ * Extends the Share_Backend interface.
+ */
+interface Share_Backend_File_Dependent extends Share_Backend {
+ /**
+ * Get the file path of the item
+ * @param string $itemSource
+ * @param string $uidOwner User that is the owner of shared item
+ * @return string|false
+ */
+ public function getFilePath($itemSource, $uidOwner);
+
+}
diff --git a/lib/public/template.php b/lib/public/template.php
index 2e265bb5e8e..a1b650649ff 100644
--- a/lib/public/template.php
+++ b/lib/public/template.php
@@ -88,7 +88,7 @@ function human_file_size( $bytes ) {
* Return the relative date in relation to today. Returns something like "last hour" or "two month ago"
* @param int $timestamp unix timestamp
* @param boolean $dateOnly
- * @return OC_L10N_String human readable interpretation of the timestamp
+ * @return \OC_L10N_String human readable interpretation of the timestamp
*/
function relative_modified_date( $timestamp, $dateOnly = false ) {
return(\relative_modified_date($timestamp, null, $dateOnly));
diff --git a/lib/public/util.php b/lib/public/util.php
index a87d26a4004..793a16c4d84 100644
--- a/lib/public/util.php
+++ b/lib/public/util.php
@@ -508,8 +508,8 @@ class Util {
/**
* Compare two strings to provide a natural sort
- * @param $a first string to compare
- * @param $b second string to compare
+ * @param string $a first string to compare
+ * @param string $b second string to compare
* @return -1 if $b comes before $a, 1 if $a comes before $b
* or 0 if the strings are identical
*/
diff --git a/occ b/occ
index e2b71fe4abc..7e47585b01e 100755
--- a/occ
+++ b/occ
@@ -1,4 +1,4 @@
-#!/usr/bin/php
+#!/usr/bin/env php
<?php
/**
* Copyright (c) 2013 Thomas Müller <thomas.mueller@tmit.eu>
diff --git a/settings/l10n/ca.js b/settings/l10n/ca.js
index 7a3e95c7cbd..8c85f381dd7 100644
--- a/settings/l10n/ca.js
+++ b/settings/l10n/ca.js
@@ -1,6 +1,7 @@
OC.L10N.register(
"settings",
{
+ "Security & Setup Warnings" : "Avisos de seguretat i configuració",
"Cron" : "Cron",
"Sharing" : "Compartir",
"Security" : "Seguretat",
@@ -36,11 +37,16 @@ OC.L10N.register(
"Back-end doesn't support password change, but the users encryption key was successfully updated." : "El dorsal no permet canviar la contrasenya, però la clau d'encripació d'usuaris s'ha actualitzat correctament.",
"Unable to change password" : "No es pot canviar la contrasenya",
"Enabled" : "Activat",
+ "Not enabled" : "Desactivat",
+ "Recommended" : "Recomanat",
"Saved" : "Desat",
"test email settings" : "prova l'arranjament del correu",
"If you received this email, the settings seem to be correct." : "Si rebeu aquest correu sembla que l'arranjament del correu és correcte.",
+ "A problem occurred while sending the email. Please revise your settings." : "Hi ha hagut un problema enviant el correu. Reviseu la configuració.",
"Email sent" : "El correu electrónic s'ha enviat",
"You need to set your user email before being able to send test emails." : "Heu d'establir un nom d'usuari abans de poder enviar correus de prova.",
+ "Are you really sure you want add \"{domain}\" as trusted domain?" : "Esteu seguir que voleu afegir \"{domain}\" com a un domini de confiança?",
+ "Add trusted domain" : "Afegir domini de confiança",
"Sending..." : "Enviant...",
"All" : "Tots",
"Please wait...." : "Espereu...",
@@ -60,6 +66,7 @@ OC.L10N.register(
"So-so password" : "Contrasenya passable",
"Good password" : "Contrasenya bona",
"Strong password" : "Contrasenya forta",
+ "Valid until {date}" : "Vàlid fins {date}",
"Delete" : "Esborra",
"Decrypting files... Please wait, this can take some time." : "Desencriptant fitxers... Espereu, això pot trigar una estona.",
"Delete encryption keys permanently." : "Esborra les claus d'encriptació permanentment.",
@@ -70,6 +77,7 @@ OC.L10N.register(
"A valid group name must be provided" : "Heu de facilitar un nom de grup vàlid",
"deleted {groupName}" : "eliminat {groupName}",
"undo" : "desfés",
+ "no group" : "sense grup",
"never" : "mai",
"deleted {userName}" : "eliminat {userName}",
"add group" : "afegeix grup",
@@ -78,6 +86,7 @@ OC.L10N.register(
"A valid password must be provided" : "Heu de facilitar una contrasenya vàlida",
"Warning: Home directory for user \"{user}\" already exists" : "Avís: la carpeta Home per l'usuari \"{user}\" ja existeix",
"__language_name__" : "Català",
+ "Personal Info" : "Informació personal",
"SSL root certificates" : "Certificats SSL root",
"Encryption" : "Xifrat",
"Everything (fatal issues, errors, warnings, info, debug)" : "Tot (problemes fatals, errors, avisos, informació, depuració)",
@@ -92,7 +101,7 @@ OC.L10N.register(
"SSL" : "SSL",
"TLS" : "TLS",
"Security Warning" : "Avís de seguretat",
- "You are accessing %s via HTTP. We strongly suggest you configure your server to require using HTTPS instead." : "Esteu accedint %s a través de HTTP. Us recomanem fermament que configureu el servidor perquè requereixi HTTPS.",
+ "You are accessing %s via HTTP. We strongly suggest you configure your server to require using HTTPS instead." : "Esteu accedint a %s a través de HTTP. Us recomanem fermament que configureu el servidor perquè requereixi HTTPS.",
"Your data directory and your files are probably accessible from the internet. The .htaccess file is not working. We strongly suggest that you configure your webserver in a way that the data directory is no longer accessible or you move the data directory outside the webserver document root." : "La carpeta de dades i els vostres fitxersprobablement són accessibles des d'Internet. La fitxer .htaccess no funciona. Us recomanem que configureu el servidor web de tal manera que la carpeta de dades no sigui accessible o que moveu la carpeta de dades fora de l'arrel de documents del servidor web.",
"Setup Warning" : "Avís de configuració",
"PHP is apparently setup to strip inline doc blocks. This will make several core apps inaccessible." : "Aparentment PHP està configurat per mostrar blocs en línia de documentació. Això farà que algunes aplicacions core siguin inaccessibles.",
@@ -103,15 +112,22 @@ OC.L10N.register(
"The PHP module 'fileinfo' is missing. We strongly recommend to enable this module to get best results with mime-type detection." : "El mòdul de PHP 'fileinfo' no s'ha trobat. Us recomanem que habiliteu aquest mòdul per obtenir millors resultats amb la detecció mime-type.",
"Your PHP version is outdated" : "La versió de PHP és obsoleta",
"Your PHP version is outdated. We strongly recommend to update to 5.3.8 or newer because older versions are known to be broken. It is possible that this installation is not working correctly." : "La versió de PHP és obsoleta. Us recomanem fermament que actualitzeu a la versió 5.3.8 o superior perquè les versions anteriors no funcionen. La instal·lació podria no funcionar correctament.",
+ "PHP charset is not set to UTF-8" : "El codi de caràcters del php no és UTF-8",
+ "PHP charset is not set to UTF-8. This can cause major issues with non-ASCII characters in file names. We highly recommend to change the value of 'default_charset' php.ini to 'UTF-8'." : "El codi de caràcters del php no és UTF-8. Això pot provocar greus problemes amb caràcter no-ASCII. Recomanem fermament canviar el valor del 'default_charset' del php.ini a 'UTF-8'",
"Locale not working" : "Locale no funciona",
"System locale can not be set to a one which supports UTF-8." : "No s'ha pogut establir cap localització del sistema amb suport per UTF-8.",
"This means that there might be problems with certain characters in file names." : "Això podria comportar problemes amb alguns caràcters en els noms dels fitxer.",
+ "We strongly suggest installing the required packages on your system to support one of the following locales: %s." : "Recomanem fermament que instal·leu els paquets requerits en el vostre sistema per suportar un dels següents idiomes: %s",
+ "URL generation in notification emails" : "Generar URL en els correus de notificació",
+ "Connectivity Checks" : "Verificacions de connectivitat",
+ "No problems found" : "No hem trovat problemes",
"Please double check the <a href='%s'>installation guides</a>." : "Comproveu les <a href='%s'>guies d'instal·lació</a>.",
"Last cron was executed at %s." : "L'últim cron s'ha executat el %s",
"Last cron was executed at %s. This is more than an hour ago, something seems wrong." : "L'últim cron es va executar a %s. Fa més d'una hora, alguna cosa sembla que va malament.",
"Cron was not executed yet!" : "El cron encara no s'ha executat!",
"Execute one task with each page loaded" : "Executa una tasca per cada paquet carregat",
"cron.php is registered at a webcron service to call cron.php every 15 minutes over http." : "cron.php està registrat en un servei webcron que fa una crida a cron.php cada 15 minuts a través de http.",
+ "Use system's cron service to call the cron.php file every 15 minutes." : "Fer servir el cron del sistema per cridar el cron.php cada 15 minuts.",
"Allow apps to use the Share API" : "Permet que les aplicacions utilitzin l'API de compartir",
"Allow users to share via link" : "Permet als usuaris compartir a través d'enllaços",
"Enforce password protection" : "Reforça la protecció amb contrasenya",
@@ -127,6 +143,8 @@ OC.L10N.register(
"These groups will still be able to receive shares, but not to initiate them." : "Aquests fitxers encara podran rebre compartits, però no podran iniciar-los.",
"Enforce HTTPS" : "Força HTTPS",
"Forces the clients to connect to %s via an encrypted connection." : "Força la connexió dels clients a %s a través d'una connexió encriptada.",
+ "Enforce HTTPS for subdomains" : "Forçar HTTPS per subdominis",
+ "Forces the clients to connect to %s and subdomains via an encrypted connection." : "Força els clients a connectar-se a %s i els subdominis amb una connexió xifrada.",
"Please connect to your %s via HTTPS to enable or disable the SSL enforcement." : "Connecteu a %s a través de HTTPS per habilitar o inhabilitar l'accés SSL.",
"This is used for sending out notifications." : "S'usa per enviar notificacions.",
"Send mode" : "Mode d'enviament",
@@ -139,6 +157,7 @@ OC.L10N.register(
"Credentials" : "Credencials",
"SMTP Username" : "Nom d'usuari SMTP",
"SMTP Password" : "Contrasenya SMTP",
+ "Store credentials" : "Emmagatzemar credencials",
"Test email settings" : "Prova l'arranjament del correu",
"Send email" : "Envia correu",
"Log level" : "Nivell de registre",
@@ -147,10 +166,13 @@ OC.L10N.register(
"Version" : "Versió",
"Developed by the <a href=\"http://ownCloud.org/contact\" target=\"_blank\">ownCloud community</a>, the <a href=\"https://github.com/owncloud\" target=\"_blank\">source code</a> is licensed under the <a href=\"http://www.gnu.org/licenses/agpl-3.0.html\" target=\"_blank\"><abbr title=\"Affero General Public License\">AGPL</abbr></a>." : "Desenvolupat per la <a href=\"http://ownCloud.org/contact\" target=\"_blank\">comunitat ownCloud</a>, el <a href=\"https://github.com/owncloud\" target=\"_blank\">codi font</a> té llicència <a href=\"http://www.gnu.org/licenses/agpl-3.0.html\" target=\"_blank\"><abbr title=\"Affero General Public License\">AGPL</abbr></a>.",
"More apps" : "Més aplicacions",
+ "Add your app" : "Afegiu la vostra app",
"by" : "per",
+ "licensed" : "llicenciat/da",
"Documentation:" : "Documentació:",
"User Documentation" : "Documentació d'usuari",
"Admin Documentation" : "Documentació d'administrador",
+ "Update to %s" : "Actualitzar a %s",
"Enable only for specific groups" : "Activa només per grups específics",
"Uninstall App" : "Desinstal·la l'aplicació",
"Administrator Documentation" : "Documentació d'administrador",
@@ -182,6 +204,10 @@ OC.L10N.register(
"Choose as profile image" : "Selecciona com a imatge de perfil",
"Language" : "Idioma",
"Help translate" : "Ajudeu-nos amb la traducció",
+ "Common Name" : "Nom comú",
+ "Valid until" : "Valid fins",
+ "Issued By" : "Emès Per",
+ "Valid until %s" : "Vàlid fins %s",
"Import Root Certificate" : "Importa certificat root",
"The encryption app is no longer enabled, please decrypt all your files" : "L'aplicació d'encriptació ja no està activada, desencripteu tots els vostres fitxers",
"Log-in password" : "Contrasenya d'accés",
@@ -189,10 +215,13 @@ OC.L10N.register(
"Your encryption keys are moved to a backup location. If something went wrong you can restore the keys. Only delete them permanently if you are sure that all files are decrypted correctly." : "Les claus d'encriptació s'han mogut a una còpia de seguretat. Si alguna cosa va malament les podreu restablir. Esborreu-les permanentment només si esteu segur que tots els fitxers es desencripten correctament.",
"Restore Encryption Keys" : "Restableix les claus d'encriptació",
"Delete Encryption Keys" : "Esborra les claus d'encriptació",
+ "Show storage location" : "Mostra la ubicació del magatzem",
+ "Show last log in" : "Mostrar l'últim accés",
"Username" : "Nom d'usuari",
"Create" : "Crea",
"Admin Recovery Password" : "Recuperació de contrasenya d'administrador",
"Enter the recovery password in order to recover the users files during password change" : "Escriviu la contrasenya de recuperació per a poder recuperar els fitxers dels usuaris en canviar la contrasenya",
+ "Search Users" : "Buscar usuaris",
"Add Group" : "Afegeix grup",
"Group" : "Grup",
"Everyone" : "Tothom",
@@ -201,6 +230,7 @@ OC.L10N.register(
"Please enter storage quota (ex: \"512 MB\" or \"12 GB\")" : "Escriviu la quota d'emmagatzemament (per ex.: \"512 MB\" o \"12 GB\")",
"Unlimited" : "Il·limitat",
"Other" : "Un altre",
+ "Group Admin for" : "Grup Admin per",
"Quota" : "Quota",
"Storage Location" : "Ubicació de l'emmagatzemament",
"Last Login" : "Últim accés",
diff --git a/settings/l10n/ca.json b/settings/l10n/ca.json
index 9298c84ae75..44a1ce6251e 100644
--- a/settings/l10n/ca.json
+++ b/settings/l10n/ca.json
@@ -1,4 +1,5 @@
{ "translations": {
+ "Security & Setup Warnings" : "Avisos de seguretat i configuració",
"Cron" : "Cron",
"Sharing" : "Compartir",
"Security" : "Seguretat",
@@ -34,11 +35,16 @@
"Back-end doesn't support password change, but the users encryption key was successfully updated." : "El dorsal no permet canviar la contrasenya, però la clau d'encripació d'usuaris s'ha actualitzat correctament.",
"Unable to change password" : "No es pot canviar la contrasenya",
"Enabled" : "Activat",
+ "Not enabled" : "Desactivat",
+ "Recommended" : "Recomanat",
"Saved" : "Desat",
"test email settings" : "prova l'arranjament del correu",
"If you received this email, the settings seem to be correct." : "Si rebeu aquest correu sembla que l'arranjament del correu és correcte.",
+ "A problem occurred while sending the email. Please revise your settings." : "Hi ha hagut un problema enviant el correu. Reviseu la configuració.",
"Email sent" : "El correu electrónic s'ha enviat",
"You need to set your user email before being able to send test emails." : "Heu d'establir un nom d'usuari abans de poder enviar correus de prova.",
+ "Are you really sure you want add \"{domain}\" as trusted domain?" : "Esteu seguir que voleu afegir \"{domain}\" com a un domini de confiança?",
+ "Add trusted domain" : "Afegir domini de confiança",
"Sending..." : "Enviant...",
"All" : "Tots",
"Please wait...." : "Espereu...",
@@ -58,6 +64,7 @@
"So-so password" : "Contrasenya passable",
"Good password" : "Contrasenya bona",
"Strong password" : "Contrasenya forta",
+ "Valid until {date}" : "Vàlid fins {date}",
"Delete" : "Esborra",
"Decrypting files... Please wait, this can take some time." : "Desencriptant fitxers... Espereu, això pot trigar una estona.",
"Delete encryption keys permanently." : "Esborra les claus d'encriptació permanentment.",
@@ -68,6 +75,7 @@
"A valid group name must be provided" : "Heu de facilitar un nom de grup vàlid",
"deleted {groupName}" : "eliminat {groupName}",
"undo" : "desfés",
+ "no group" : "sense grup",
"never" : "mai",
"deleted {userName}" : "eliminat {userName}",
"add group" : "afegeix grup",
@@ -76,6 +84,7 @@
"A valid password must be provided" : "Heu de facilitar una contrasenya vàlida",
"Warning: Home directory for user \"{user}\" already exists" : "Avís: la carpeta Home per l'usuari \"{user}\" ja existeix",
"__language_name__" : "Català",
+ "Personal Info" : "Informació personal",
"SSL root certificates" : "Certificats SSL root",
"Encryption" : "Xifrat",
"Everything (fatal issues, errors, warnings, info, debug)" : "Tot (problemes fatals, errors, avisos, informació, depuració)",
@@ -90,7 +99,7 @@
"SSL" : "SSL",
"TLS" : "TLS",
"Security Warning" : "Avís de seguretat",
- "You are accessing %s via HTTP. We strongly suggest you configure your server to require using HTTPS instead." : "Esteu accedint %s a través de HTTP. Us recomanem fermament que configureu el servidor perquè requereixi HTTPS.",
+ "You are accessing %s via HTTP. We strongly suggest you configure your server to require using HTTPS instead." : "Esteu accedint a %s a través de HTTP. Us recomanem fermament que configureu el servidor perquè requereixi HTTPS.",
"Your data directory and your files are probably accessible from the internet. The .htaccess file is not working. We strongly suggest that you configure your webserver in a way that the data directory is no longer accessible or you move the data directory outside the webserver document root." : "La carpeta de dades i els vostres fitxersprobablement són accessibles des d'Internet. La fitxer .htaccess no funciona. Us recomanem que configureu el servidor web de tal manera que la carpeta de dades no sigui accessible o que moveu la carpeta de dades fora de l'arrel de documents del servidor web.",
"Setup Warning" : "Avís de configuració",
"PHP is apparently setup to strip inline doc blocks. This will make several core apps inaccessible." : "Aparentment PHP està configurat per mostrar blocs en línia de documentació. Això farà que algunes aplicacions core siguin inaccessibles.",
@@ -101,15 +110,22 @@
"The PHP module 'fileinfo' is missing. We strongly recommend to enable this module to get best results with mime-type detection." : "El mòdul de PHP 'fileinfo' no s'ha trobat. Us recomanem que habiliteu aquest mòdul per obtenir millors resultats amb la detecció mime-type.",
"Your PHP version is outdated" : "La versió de PHP és obsoleta",
"Your PHP version is outdated. We strongly recommend to update to 5.3.8 or newer because older versions are known to be broken. It is possible that this installation is not working correctly." : "La versió de PHP és obsoleta. Us recomanem fermament que actualitzeu a la versió 5.3.8 o superior perquè les versions anteriors no funcionen. La instal·lació podria no funcionar correctament.",
+ "PHP charset is not set to UTF-8" : "El codi de caràcters del php no és UTF-8",
+ "PHP charset is not set to UTF-8. This can cause major issues with non-ASCII characters in file names. We highly recommend to change the value of 'default_charset' php.ini to 'UTF-8'." : "El codi de caràcters del php no és UTF-8. Això pot provocar greus problemes amb caràcter no-ASCII. Recomanem fermament canviar el valor del 'default_charset' del php.ini a 'UTF-8'",
"Locale not working" : "Locale no funciona",
"System locale can not be set to a one which supports UTF-8." : "No s'ha pogut establir cap localització del sistema amb suport per UTF-8.",
"This means that there might be problems with certain characters in file names." : "Això podria comportar problemes amb alguns caràcters en els noms dels fitxer.",
+ "We strongly suggest installing the required packages on your system to support one of the following locales: %s." : "Recomanem fermament que instal·leu els paquets requerits en el vostre sistema per suportar un dels següents idiomes: %s",
+ "URL generation in notification emails" : "Generar URL en els correus de notificació",
+ "Connectivity Checks" : "Verificacions de connectivitat",
+ "No problems found" : "No hem trovat problemes",
"Please double check the <a href='%s'>installation guides</a>." : "Comproveu les <a href='%s'>guies d'instal·lació</a>.",
"Last cron was executed at %s." : "L'últim cron s'ha executat el %s",
"Last cron was executed at %s. This is more than an hour ago, something seems wrong." : "L'últim cron es va executar a %s. Fa més d'una hora, alguna cosa sembla que va malament.",
"Cron was not executed yet!" : "El cron encara no s'ha executat!",
"Execute one task with each page loaded" : "Executa una tasca per cada paquet carregat",
"cron.php is registered at a webcron service to call cron.php every 15 minutes over http." : "cron.php està registrat en un servei webcron que fa una crida a cron.php cada 15 minuts a través de http.",
+ "Use system's cron service to call the cron.php file every 15 minutes." : "Fer servir el cron del sistema per cridar el cron.php cada 15 minuts.",
"Allow apps to use the Share API" : "Permet que les aplicacions utilitzin l'API de compartir",
"Allow users to share via link" : "Permet als usuaris compartir a través d'enllaços",
"Enforce password protection" : "Reforça la protecció amb contrasenya",
@@ -125,6 +141,8 @@
"These groups will still be able to receive shares, but not to initiate them." : "Aquests fitxers encara podran rebre compartits, però no podran iniciar-los.",
"Enforce HTTPS" : "Força HTTPS",
"Forces the clients to connect to %s via an encrypted connection." : "Força la connexió dels clients a %s a través d'una connexió encriptada.",
+ "Enforce HTTPS for subdomains" : "Forçar HTTPS per subdominis",
+ "Forces the clients to connect to %s and subdomains via an encrypted connection." : "Força els clients a connectar-se a %s i els subdominis amb una connexió xifrada.",
"Please connect to your %s via HTTPS to enable or disable the SSL enforcement." : "Connecteu a %s a través de HTTPS per habilitar o inhabilitar l'accés SSL.",
"This is used for sending out notifications." : "S'usa per enviar notificacions.",
"Send mode" : "Mode d'enviament",
@@ -137,6 +155,7 @@
"Credentials" : "Credencials",
"SMTP Username" : "Nom d'usuari SMTP",
"SMTP Password" : "Contrasenya SMTP",
+ "Store credentials" : "Emmagatzemar credencials",
"Test email settings" : "Prova l'arranjament del correu",
"Send email" : "Envia correu",
"Log level" : "Nivell de registre",
@@ -145,10 +164,13 @@
"Version" : "Versió",
"Developed by the <a href=\"http://ownCloud.org/contact\" target=\"_blank\">ownCloud community</a>, the <a href=\"https://github.com/owncloud\" target=\"_blank\">source code</a> is licensed under the <a href=\"http://www.gnu.org/licenses/agpl-3.0.html\" target=\"_blank\"><abbr title=\"Affero General Public License\">AGPL</abbr></a>." : "Desenvolupat per la <a href=\"http://ownCloud.org/contact\" target=\"_blank\">comunitat ownCloud</a>, el <a href=\"https://github.com/owncloud\" target=\"_blank\">codi font</a> té llicència <a href=\"http://www.gnu.org/licenses/agpl-3.0.html\" target=\"_blank\"><abbr title=\"Affero General Public License\">AGPL</abbr></a>.",
"More apps" : "Més aplicacions",
+ "Add your app" : "Afegiu la vostra app",
"by" : "per",
+ "licensed" : "llicenciat/da",
"Documentation:" : "Documentació:",
"User Documentation" : "Documentació d'usuari",
"Admin Documentation" : "Documentació d'administrador",
+ "Update to %s" : "Actualitzar a %s",
"Enable only for specific groups" : "Activa només per grups específics",
"Uninstall App" : "Desinstal·la l'aplicació",
"Administrator Documentation" : "Documentació d'administrador",
@@ -180,6 +202,10 @@
"Choose as profile image" : "Selecciona com a imatge de perfil",
"Language" : "Idioma",
"Help translate" : "Ajudeu-nos amb la traducció",
+ "Common Name" : "Nom comú",
+ "Valid until" : "Valid fins",
+ "Issued By" : "Emès Per",
+ "Valid until %s" : "Vàlid fins %s",
"Import Root Certificate" : "Importa certificat root",
"The encryption app is no longer enabled, please decrypt all your files" : "L'aplicació d'encriptació ja no està activada, desencripteu tots els vostres fitxers",
"Log-in password" : "Contrasenya d'accés",
@@ -187,10 +213,13 @@
"Your encryption keys are moved to a backup location. If something went wrong you can restore the keys. Only delete them permanently if you are sure that all files are decrypted correctly." : "Les claus d'encriptació s'han mogut a una còpia de seguretat. Si alguna cosa va malament les podreu restablir. Esborreu-les permanentment només si esteu segur que tots els fitxers es desencripten correctament.",
"Restore Encryption Keys" : "Restableix les claus d'encriptació",
"Delete Encryption Keys" : "Esborra les claus d'encriptació",
+ "Show storage location" : "Mostra la ubicació del magatzem",
+ "Show last log in" : "Mostrar l'últim accés",
"Username" : "Nom d'usuari",
"Create" : "Crea",
"Admin Recovery Password" : "Recuperació de contrasenya d'administrador",
"Enter the recovery password in order to recover the users files during password change" : "Escriviu la contrasenya de recuperació per a poder recuperar els fitxers dels usuaris en canviar la contrasenya",
+ "Search Users" : "Buscar usuaris",
"Add Group" : "Afegeix grup",
"Group" : "Grup",
"Everyone" : "Tothom",
@@ -199,6 +228,7 @@
"Please enter storage quota (ex: \"512 MB\" or \"12 GB\")" : "Escriviu la quota d'emmagatzemament (per ex.: \"512 MB\" o \"12 GB\")",
"Unlimited" : "Il·limitat",
"Other" : "Un altre",
+ "Group Admin for" : "Grup Admin per",
"Quota" : "Quota",
"Storage Location" : "Ubicació de l'emmagatzemament",
"Last Login" : "Últim accés",
diff --git a/settings/l10n/sk_SK.js b/settings/l10n/sk_SK.js
index 3e44cd259e4..755ecd8f8ed 100644
--- a/settings/l10n/sk_SK.js
+++ b/settings/l10n/sk_SK.js
@@ -219,6 +219,7 @@ OC.L10N.register(
"Create" : "Vytvoriť",
"Admin Recovery Password" : "Obnovenie hesla administrátora",
"Enter the recovery password in order to recover the users files during password change" : "Zadajte heslo pre obnovenie súborov používateľa pri zmene hesla",
+ "Search Users" : "Hľadať používateľov",
"Add Group" : "Pridať skupinu",
"Group" : "Skupina",
"Everyone" : "Všetci",
diff --git a/settings/l10n/sk_SK.json b/settings/l10n/sk_SK.json
index f5fd698cd2a..35c54da58b0 100644
--- a/settings/l10n/sk_SK.json
+++ b/settings/l10n/sk_SK.json
@@ -217,6 +217,7 @@
"Create" : "Vytvoriť",
"Admin Recovery Password" : "Obnovenie hesla administrátora",
"Enter the recovery password in order to recover the users files during password change" : "Zadajte heslo pre obnovenie súborov používateľa pri zmene hesla",
+ "Search Users" : "Hľadať používateľov",
"Add Group" : "Pridať skupinu",
"Group" : "Skupina",
"Everyone" : "Všetci",
diff --git a/settings/l10n/tr.js b/settings/l10n/tr.js
index 0b6660fd076..e97674bf0fc 100644
--- a/settings/l10n/tr.js
+++ b/settings/l10n/tr.js
@@ -138,7 +138,7 @@ OC.L10N.register(
"days" : "gün sonra dolsun",
"Enforce expiration date" : "Son kullanma tarihini zorla",
"Allow resharing" : "Yeniden paylaşıma izin ver",
- "Restrict users to only share with users in their groups" : "Kullanıcıların sadece kendi gruplarındaki kullanıcılarla paylaşmasına sınırla",
+ "Restrict users to only share with users in their groups" : "Kullanıcıların, dosyaları sadece kendi gruplarındaki kullanıcılarla paylaşmasına izin ver",
"Allow users to send mail notification for shared files" : "Paylaşılmış dosyalar için kullanıcıların posta bildirimi göndermesine izin ver",
"Exclude groups from sharing" : "Grupları paylaşma eyleminden hariç tut",
"These groups will still be able to receive shares, but not to initiate them." : "Bu gruplar hala paylaşımları alabilecek, ancak başlatamayacaktır.",
diff --git a/settings/l10n/tr.json b/settings/l10n/tr.json
index 26f39922609..f1c869101a9 100644
--- a/settings/l10n/tr.json
+++ b/settings/l10n/tr.json
@@ -136,7 +136,7 @@
"days" : "gün sonra dolsun",
"Enforce expiration date" : "Son kullanma tarihini zorla",
"Allow resharing" : "Yeniden paylaşıma izin ver",
- "Restrict users to only share with users in their groups" : "Kullanıcıların sadece kendi gruplarındaki kullanıcılarla paylaşmasına sınırla",
+ "Restrict users to only share with users in their groups" : "Kullanıcıların, dosyaları sadece kendi gruplarındaki kullanıcılarla paylaşmasına izin ver",
"Allow users to send mail notification for shared files" : "Paylaşılmış dosyalar için kullanıcıların posta bildirimi göndermesine izin ver",
"Exclude groups from sharing" : "Grupları paylaşma eyleminden hariç tut",
"These groups will still be able to receive shares, but not to initiate them." : "Bu gruplar hala paylaşımları alabilecek, ancak başlatamayacaktır.",
diff --git a/settings/l10n/uk.js b/settings/l10n/uk.js
index 6cdef63b2ec..3350edeeb5e 100644
--- a/settings/l10n/uk.js
+++ b/settings/l10n/uk.js
@@ -117,6 +117,7 @@ OC.L10N.register(
"Locale not working" : "Локалізація не працює",
"System locale can not be set to a one which supports UTF-8." : "Неможливо встановити системну локаль, яка б підтримувала UTF-8.",
"This means that there might be problems with certain characters in file names." : "Це означає, що можуть виникати проблеми з деякими символами в іменах файлів.",
+ "We strongly suggest installing the required packages on your system to support one of the following locales: %s." : "Пропонуємо встановити необхідні пакети для вашої системи для підтримки однієї з наступних мов %s.",
"URL generation in notification emails" : "Генерування URL для повідомлень в електроних листах",
"If your installation is not installed in the root of the domain and uses system cron, there can be issues with the URL generation. To avoid these problems, please set the \"overwritewebroot\" option in your config.php file to the webroot path of your installation (Suggested: \"%s\")" : "Якщо ваша копія ownCloud встановлена не в корені домену та використовує систему планування CRON, можливі проблеми з генерацією правильних URL. Щоб уникнути цього, встановіть опцію overwritewebroot файла config.php відповідно до теки розташування установки (Ймовірніше за все, це \"%s\")",
"Connectivity Checks" : "Перевірка З'єднання",
@@ -143,6 +144,8 @@ OC.L10N.register(
"These groups will still be able to receive shares, but not to initiate them." : "Ці групи зможуть отримувати спільні файли, але не зможуть відправляти їх.",
"Enforce HTTPS" : "Примусове застосування HTTPS",
"Forces the clients to connect to %s via an encrypted connection." : "Зобов'язати клієнтів під'єднуватись до %s через шифроване з'єднання.",
+ "Enforce HTTPS for subdomains" : "Примусове застосувати HTTPS для піддоменів",
+ "Forces the clients to connect to %s and subdomains via an encrypted connection." : "Змушувати клієнтів під'єднуватися до %s та піддоменів за допомогою зашифрованого з'єднання.",
"Please connect to your %s via HTTPS to enable or disable the SSL enforcement." : "Будь ласка, під'єднайтесь до цього %s за допомогою HTTPS, щоб увімкнути або вимкнути використання SSL.",
"This is used for sending out notifications." : "Використовується для відсилання повідомлень.",
"Send mode" : "Надіслати повідомлення",
@@ -219,6 +222,7 @@ OC.L10N.register(
"Create" : "Створити",
"Admin Recovery Password" : "Пароль адміністратора для відновлення",
"Enter the recovery password in order to recover the users files during password change" : "Введіть пароль для того, щоб відновити файли користувачів при зміні паролю",
+ "Search Users" : "Шукати користувачів",
"Add Group" : "Додати групу",
"Group" : "Група",
"Everyone" : "Всі",
diff --git a/settings/l10n/uk.json b/settings/l10n/uk.json
index b05f4e95e32..27d26dd1321 100644
--- a/settings/l10n/uk.json
+++ b/settings/l10n/uk.json
@@ -115,6 +115,7 @@
"Locale not working" : "Локалізація не працює",
"System locale can not be set to a one which supports UTF-8." : "Неможливо встановити системну локаль, яка б підтримувала UTF-8.",
"This means that there might be problems with certain characters in file names." : "Це означає, що можуть виникати проблеми з деякими символами в іменах файлів.",
+ "We strongly suggest installing the required packages on your system to support one of the following locales: %s." : "Пропонуємо встановити необхідні пакети для вашої системи для підтримки однієї з наступних мов %s.",
"URL generation in notification emails" : "Генерування URL для повідомлень в електроних листах",
"If your installation is not installed in the root of the domain and uses system cron, there can be issues with the URL generation. To avoid these problems, please set the \"overwritewebroot\" option in your config.php file to the webroot path of your installation (Suggested: \"%s\")" : "Якщо ваша копія ownCloud встановлена не в корені домену та використовує систему планування CRON, можливі проблеми з генерацією правильних URL. Щоб уникнути цього, встановіть опцію overwritewebroot файла config.php відповідно до теки розташування установки (Ймовірніше за все, це \"%s\")",
"Connectivity Checks" : "Перевірка З'єднання",
@@ -141,6 +142,8 @@
"These groups will still be able to receive shares, but not to initiate them." : "Ці групи зможуть отримувати спільні файли, але не зможуть відправляти їх.",
"Enforce HTTPS" : "Примусове застосування HTTPS",
"Forces the clients to connect to %s via an encrypted connection." : "Зобов'язати клієнтів під'єднуватись до %s через шифроване з'єднання.",
+ "Enforce HTTPS for subdomains" : "Примусове застосувати HTTPS для піддоменів",
+ "Forces the clients to connect to %s and subdomains via an encrypted connection." : "Змушувати клієнтів під'єднуватися до %s та піддоменів за допомогою зашифрованого з'єднання.",
"Please connect to your %s via HTTPS to enable or disable the SSL enforcement." : "Будь ласка, під'єднайтесь до цього %s за допомогою HTTPS, щоб увімкнути або вимкнути використання SSL.",
"This is used for sending out notifications." : "Використовується для відсилання повідомлень.",
"Send mode" : "Надіслати повідомлення",
@@ -217,6 +220,7 @@
"Create" : "Створити",
"Admin Recovery Password" : "Пароль адміністратора для відновлення",
"Enter the recovery password in order to recover the users files during password change" : "Введіть пароль для того, щоб відновити файли користувачів при зміні паролю",
+ "Search Users" : "Шукати користувачів",
"Add Group" : "Додати групу",
"Group" : "Група",
"Everyone" : "Всі",
diff --git a/tests/core/lostpassword/controller/lostcontrollertest.php b/tests/core/lostpassword/controller/lostcontrollertest.php
index 5da9e5ce48d..2f2105b85e8 100644
--- a/tests/core/lostpassword/controller/lostcontrollertest.php
+++ b/tests/core/lostpassword/controller/lostcontrollertest.php
@@ -102,6 +102,11 @@ class LostControllerTest extends \PHPUnit_Framework_TestCase {
}
public function testEmailSuccessful() {
+ if (\OC_Util::runningOnWindows()) {
+ // FIXME after OC_Mail refactor
+ $this->markTestSkipped('[Windows] sendmail is not supported on windows');
+ }
+
$randomToken = $this->container['SecureRandom'];
$this->container['SecureRandom']
->expects($this->once())
diff --git a/tests/data/app/expected-info.json b/tests/data/app/expected-info.json
new file mode 100644
index 00000000000..c67d6d657d2
--- /dev/null
+++ b/tests/data/app/expected-info.json
@@ -0,0 +1,19 @@
+{
+ "info": [],
+ "remote": [],
+ "public": [],
+ "id": "files_encryption",
+ "name": "Server-side Encryption",
+ "description": "\n\tThis application encrypts all files accessed by ownCloud at rest, wherever they are stored. As an example, with this application enabled, external cloud based Amazon S3 storage will be encrypted, protecting this data on storage outside of the control of the Admin. When this application is enabled for the first time, all files are encrypted as users log in and are prompted for their password. The recommended recovery key option enables recovery of files in case the key is lost. \n\tNote that this app encrypts all files that are touched by ownCloud, so external storage providers and applications such as SharePoint will see new files encrypted when they are accessed. Encryption is based on AES 128 or 256 bit keys. More information is available in the Encryption documentation \n\t",
+ "licence": "AGPL",
+ "author": "Sam Tuke, Bjoern Schiessle, Florin Peter",
+ "requiremin": "4",
+ "shipped": "true",
+ "documentation": {
+ "user": "https://docs.example.com/server/go.php?to=user-encryption",
+ "admin": "https://docs.example.com/server/go.php?to=admin-encryption"
+ },
+ "rememberlogin": "false",
+ "types": ["filesystem"],
+ "ocsid": "166047"
+}
diff --git a/tests/data/app/invalid-info.xml b/tests/data/app/invalid-info.xml
new file mode 100644
index 00000000000..3947f5420c2
--- /dev/null
+++ b/tests/data/app/invalid-info.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<info
+ <id>files_encryption</id>
+ <name>Server-side Encryption</name>
+ <description>
+ This application encrypts all files accessed by ownCloud at rest, wherever they are stored. As an example, with this application enabled, external cloud based Amazon S3 storage will be encrypted, protecting this data on storage outside of the control of the Admin. When this application is enabled for the first time, all files are encrypted as users log in and are prompted for their password. The recommended recovery key option enables recovery of files in case the key is lost.
+ Note that this app encrypts all files that are touched by ownCloud, so external storage providers and applications such as SharePoint will see new files encrypted when they are accessed. Encryption is based on AES 128 or 256 bit keys. More information is available in the Encryption documentation
+ </description>
+ <licence>AGPL</licence>
+ <author>Sam Tuke, Bjoern Schiessle, Florin Peter</author>
+ <requiremin>4</requiremin>
+ <shipped>true</shipped>
+ <documentation>
+ <user>user-encryption</user>
+ <admin>admin-encryption</admin>
+ </documentation>
+ <rememberlogin>false</rememberlogin>
+ <types>
+ <filesystem/>
+ </types>
+ <ocsid>166047</ocsid>
+</info>
diff --git a/tests/data/app/valid-info.xml b/tests/data/app/valid-info.xml
new file mode 100644
index 00000000000..6fcef693bed
--- /dev/null
+++ b/tests/data/app/valid-info.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<info>
+ <id>files_encryption</id>
+ <name>Server-side Encryption</name>
+ <description>
+ This application encrypts all files accessed by ownCloud at rest, wherever they are stored. As an example, with this application enabled, external cloud based Amazon S3 storage will be encrypted, protecting this data on storage outside of the control of the Admin. When this application is enabled for the first time, all files are encrypted as users log in and are prompted for their password. The recommended recovery key option enables recovery of files in case the key is lost.
+ Note that this app encrypts all files that are touched by ownCloud, so external storage providers and applications such as SharePoint will see new files encrypted when they are accessed. Encryption is based on AES 128 or 256 bit keys. More information is available in the Encryption documentation
+ </description>
+ <licence>AGPL</licence>
+ <author>Sam Tuke, Bjoern Schiessle, Florin Peter</author>
+ <requiremin>4</requiremin>
+ <shipped>true</shipped>
+ <documentation>
+ <user>user-encryption</user>
+ <admin>admin-encryption</admin>
+ </documentation>
+ <rememberlogin>false</rememberlogin>
+ <types>
+ <filesystem/>
+ </types>
+ <ocsid>166047</ocsid>
+</info>
diff --git a/tests/lib/activitymanager.php b/tests/lib/activitymanager.php
index 85f8320de09..0683eb68193 100644
--- a/tests/lib/activitymanager.php
+++ b/tests/lib/activitymanager.php
@@ -87,11 +87,14 @@ class Test_ActivityManager extends \Test\TestCase {
}
public function testQueryForFilter() {
+ $this->activityManager->registerExtension(function() {
+ return new SimpleExtension();
+ });
$result = $this->activityManager->getQueryForFilter('filter1');
$this->assertEquals(
array(
- '`app` = ? and `message` like ?',
- array('mail', 'ownCloud%')
+ ' and ((`app` = ? and `message` like ?) or (`app` = ? and `message` like ?))',
+ array('mail', 'ownCloud%', 'mail', 'ownCloud%')
), $result
);
diff --git a/tests/lib/app/infoparser.php b/tests/lib/app/infoparser.php
new file mode 100644
index 00000000000..277e1582e45
--- /dev/null
+++ b/tests/lib/app/infoparser.php
@@ -0,0 +1,53 @@
+<?php
+
+/**
+ * @author Thomas Müller
+ * @copyright 2014 Thomas Müller deepdiver@owncloud.com
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace Test\App;
+
+use OC;
+
+class InfoParser extends \PHPUnit_Framework_TestCase {
+
+ /**
+ * @var \OC\App\InfoParser
+ */
+ private $parser;
+
+ public function setUp() {
+ $config = $this->getMockBuilder('\OC\AllConfig')
+ ->disableOriginalConstructor()->getMock();
+ $httpHelper = $this->getMockBuilder('\OC\HTTPHelper')
+ ->setConstructorArgs(array($config))
+ ->setMethods(array('getHeaders'))
+ ->getMock();
+ $urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ //linkToDocs
+ $urlGenerator->expects($this->any())
+ ->method('linkToDocs')
+ ->will($this->returnCallback(function ($url) {
+ return "https://docs.example.com/server/go.php?to=$url";
+ }));
+
+ $this->parser = new \OC\App\InfoParser($httpHelper, $urlGenerator);
+ }
+
+ public function testParsingValidXml() {
+ $expectedData = json_decode(file_get_contents(OC::$SERVERROOT.'/tests/data/app/expected-info.json'), true);
+ $data = $this->parser->parse(OC::$SERVERROOT.'/tests/data/app/valid-info.xml');
+
+ $this->assertEquals($expectedData, $data);
+ }
+
+ public function testParsingInvalidXml() {
+ $data = $this->parser->parse(OC::$SERVERROOT.'/tests/data/app/invalid-info.xml');
+ $this->assertNull($data);
+ }
+}
diff --git a/tests/lib/appframework/AppTest.php b/tests/lib/appframework/AppTest.php
index bd565e9765e..86128db118f 100644
--- a/tests/lib/appframework/AppTest.php
+++ b/tests/lib/appframework/AppTest.php
@@ -63,7 +63,7 @@ class AppTest extends \Test\TestCase {
public function testControllerNameAndMethodAreBeingPassed(){
- $return = array(null, array(), null);
+ $return = array(null, array(), array(), null);
$this->dispatcher->expects($this->once())
->method('dispatch')
->with($this->equalTo($this->controller),
diff --git a/tests/lib/appframework/http/DispatcherTest.php b/tests/lib/appframework/http/DispatcherTest.php
index f92e7161e6b..45ebd6fce96 100644
--- a/tests/lib/appframework/http/DispatcherTest.php
+++ b/tests/lib/appframework/http/DispatcherTest.php
@@ -227,7 +227,7 @@ class DispatcherTest extends \Test\TestCase {
$this->assertEquals($httpHeaders, $response[0]);
$this->assertEquals($responseHeaders, $response[1]);
- $this->assertEquals($out, $response[2]);
+ $this->assertEquals($out, $response[3]);
}
@@ -246,7 +246,7 @@ class DispatcherTest extends \Test\TestCase {
$this->assertEquals($httpHeaders, $response[0]);
$this->assertEquals($responseHeaders, $response[1]);
- $this->assertEquals($out, $response[2]);
+ $this->assertEquals($out, $response[3]);
}
@@ -301,7 +301,7 @@ class DispatcherTest extends \Test\TestCase {
$this->dispatcherPassthrough();
$response = $this->dispatcher->dispatch($controller, 'exec');
- $this->assertEquals('[3,true,4,1]', $response[2]);
+ $this->assertEquals('[3,true,4,1]', $response[3]);
}
@@ -324,7 +324,7 @@ class DispatcherTest extends \Test\TestCase {
$this->dispatcherPassthrough();
$response = $this->dispatcher->dispatch($controller, 'exec');
- $this->assertEquals('[3,true,4,7]', $response[2]);
+ $this->assertEquals('[3,true,4,7]', $response[3]);
}
@@ -350,7 +350,7 @@ class DispatcherTest extends \Test\TestCase {
$this->dispatcherPassthrough();
$response = $this->dispatcher->dispatch($controller, 'exec');
- $this->assertEquals('{"text":[3,false,4,1]}', $response[2]);
+ $this->assertEquals('{"text":[3,false,4,1]}', $response[3]);
}
@@ -375,7 +375,7 @@ class DispatcherTest extends \Test\TestCase {
$this->dispatcherPassthrough();
$response = $this->dispatcher->dispatch($controller, 'execDataResponse');
- $this->assertEquals('{"text":[3,false,4,1]}', $response[2]);
+ $this->assertEquals('{"text":[3,false,4,1]}', $response[3]);
}
@@ -401,7 +401,7 @@ class DispatcherTest extends \Test\TestCase {
$this->dispatcherPassthrough();
$response = $this->dispatcher->dispatch($controller, 'exec');
- $this->assertEquals('{"text":[3,false,4,1]}', $response[2]);
+ $this->assertEquals('{"text":[3,false,4,1]}', $response[3]);
}
@@ -429,7 +429,7 @@ class DispatcherTest extends \Test\TestCase {
$this->dispatcherPassthrough();
$response = $this->dispatcher->dispatch($controller, 'exec');
- $this->assertEquals('{"text":[3,true,4,1]}', $response[2]);
+ $this->assertEquals('{"text":[3,true,4,1]}', $response[3]);
}
diff --git a/tests/lib/appframework/http/ResponseTest.php b/tests/lib/appframework/http/ResponseTest.php
index 04e19fdaf71..b4352348bae 100644
--- a/tests/lib/appframework/http/ResponseTest.php
+++ b/tests/lib/appframework/http/ResponseTest.php
@@ -76,6 +76,92 @@ class ResponseTest extends \Test\TestCase {
}
+ public function testAddCookie() {
+ $this->childResponse->addCookie('foo', 'bar');
+ $this->childResponse->addCookie('bar', 'foo', new \DateTime('1970-01-01'));
+
+ $expectedResponse = array(
+ 'foo' => array(
+ 'value' => 'bar',
+ 'expireDate' => null,
+ ),
+ 'bar' => array(
+ 'value' => 'foo',
+ 'expireDate' => new \DateTime('1970-01-01')
+ )
+ );
+ $this->assertEquals($expectedResponse, $this->childResponse->getCookies());
+ }
+
+
+ function testSetCookies() {
+ $expected = array(
+ 'foo' => array(
+ 'value' => 'bar',
+ 'expireDate' => null,
+ ),
+ 'bar' => array(
+ 'value' => 'foo',
+ 'expireDate' => new \DateTime('1970-01-01')
+ )
+ );
+
+ $this->childResponse->setCookies($expected);
+ $cookies = $this->childResponse->getCookies();
+
+ $this->assertEquals($expected, $cookies);
+ }
+
+
+ function testInvalidateCookie() {
+ $this->childResponse->addCookie('foo', 'bar');
+ $this->childResponse->invalidateCookie('foo');
+ $expected = array(
+ 'foo' => array(
+ 'value' => 'expired',
+ 'expireDate' => new \DateTime('1971-01-01')
+ )
+ );
+
+ $cookies = $this->childResponse->getCookies();
+
+ $this->assertEquals($expected, $cookies);
+ }
+
+
+ function testInvalidateCookies() {
+ $this->childResponse->addCookie('foo', 'bar');
+ $this->childResponse->addCookie('bar', 'foo');
+ $expected = array(
+ 'foo' => array(
+ 'value' => 'bar',
+ 'expireDate' => null
+ ),
+ 'bar' => array(
+ 'value' => 'foo',
+ 'expireDate' => null
+ )
+ );
+ $cookies = $this->childResponse->getCookies();
+ $this->assertEquals($expected, $cookies);
+
+ $this->childResponse->invalidateCookies(array('foo', 'bar'));
+ $expected = array(
+ 'foo' => array(
+ 'value' => 'expired',
+ 'expireDate' => new \DateTime('1971-01-01')
+ ),
+ 'bar' => array(
+ 'value' => 'expired',
+ 'expireDate' => new \DateTime('1971-01-01')
+ )
+ );
+
+ $cookies = $this->childResponse->getCookies();
+ $this->assertEquals($expected, $cookies);
+ }
+
+
public function testRenderReturnNullByDefault(){
$this->assertEquals(null, $this->childResponse->render());
}
diff --git a/tests/lib/connector/sabre/file.php b/tests/lib/connector/sabre/file.php
index cfc6e29ae74..b4fdd91f512 100644
--- a/tests/lib/connector/sabre/file.php
+++ b/tests/lib/connector/sabre/file.php
@@ -23,7 +23,7 @@ class Test_OC_Connector_Sabre_File extends \Test\TestCase {
->will($this->returnValue('/test.txt'));
$info = new \OC\Files\FileInfo('/test.txt', null, null, array(
- 'permissions'=>\OCP\PERMISSION_ALL
+ 'permissions'=>\OCP\Constants::PERMISSION_ALL
));
$file = new OC_Connector_Sabre_File($view, $info);
@@ -58,7 +58,7 @@ class Test_OC_Connector_Sabre_File extends \Test\TestCase {
$_SERVER['REQUEST_METHOD'] = 'PUT';
$info = new \OC\Files\FileInfo('/test.txt', null, null, array(
- 'permissions' => \OCP\PERMISSION_ALL
+ 'permissions' => \OCP\Constants::PERMISSION_ALL
));
$file = new OC_Connector_Sabre_File($view, $info);
@@ -82,7 +82,7 @@ class Test_OC_Connector_Sabre_File extends \Test\TestCase {
->will($this->returnValue('/super*star.txt'));
$info = new \OC\Files\FileInfo('/super*star.txt', null, null, array(
- 'permissions' => \OCP\PERMISSION_ALL
+ 'permissions' => \OCP\Constants::PERMISSION_ALL
));
$file = new OC_Connector_Sabre_File($view, $info);
@@ -103,7 +103,7 @@ class Test_OC_Connector_Sabre_File extends \Test\TestCase {
->will($this->returnValue('/super*star.txt'));
$info = new \OC\Files\FileInfo('/super*star.txt', null, null, array(
- 'permissions' => \OCP\PERMISSION_ALL
+ 'permissions' => \OCP\Constants::PERMISSION_ALL
));
$file = new OC_Connector_Sabre_File($view, $info);
$file->setName('/super*star.txt');
@@ -135,7 +135,7 @@ class Test_OC_Connector_Sabre_File extends \Test\TestCase {
$_SERVER['REQUEST_METHOD'] = 'PUT';
$info = new \OC\Files\FileInfo('/test.txt', null, null, array(
- 'permissions' => \OCP\PERMISSION_ALL
+ 'permissions' => \OCP\Constants::PERMISSION_ALL
));
$file = new OC_Connector_Sabre_File($view, $info);
@@ -157,7 +157,7 @@ class Test_OC_Connector_Sabre_File extends \Test\TestCase {
->will($this->returnValue(true));
$info = new \OC\Files\FileInfo('/test.txt', null, null, array(
- 'permissions' => \OCP\PERMISSION_ALL
+ 'permissions' => \OCP\Constants::PERMISSION_ALL
));
$file = new OC_Connector_Sabre_File($view, $info);
@@ -198,7 +198,7 @@ class Test_OC_Connector_Sabre_File extends \Test\TestCase {
->will($this->returnValue(false));
$info = new \OC\Files\FileInfo('/test.txt', null, null, array(
- 'permissions' => \OCP\PERMISSION_ALL
+ 'permissions' => \OCP\Constants::PERMISSION_ALL
));
$file = new OC_Connector_Sabre_File($view, $info);
diff --git a/tests/lib/connector/sabre/node.php b/tests/lib/connector/sabre/node.php
index 9a2bf41bd19..1e927deed44 100644
--- a/tests/lib/connector/sabre/node.php
+++ b/tests/lib/connector/sabre/node.php
@@ -15,15 +15,15 @@ use OC\Files\View;
class Node extends \Test\TestCase {
public function davPermissionsProvider() {
return array(
- array(\OCP\PERMISSION_ALL, 'file', false, false, 'RDNVW'),
- array(\OCP\PERMISSION_ALL, 'dir', false, false, 'RDNVCK'),
- array(\OCP\PERMISSION_ALL, 'file', true, false, 'SRDNVW'),
- array(\OCP\PERMISSION_ALL, 'file', true, true, 'SRMDNVW'),
- array(\OCP\PERMISSION_ALL - \OCP\PERMISSION_SHARE, 'file', true, false, 'SDNVW'),
- array(\OCP\PERMISSION_ALL - \OCP\PERMISSION_UPDATE, 'file', false, false, 'RDNV'),
- array(\OCP\PERMISSION_ALL - \OCP\PERMISSION_DELETE, 'file', false, false, 'RW'),
- array(\OCP\PERMISSION_ALL - \OCP\PERMISSION_CREATE, 'file', false, false, 'RDNVW'),
- array(\OCP\PERMISSION_ALL - \OCP\PERMISSION_CREATE, 'dir', false, false, 'RDNV'),
+ array(\OCP\Constants::PERMISSION_ALL, 'file', false, false, 'RDNVW'),
+ array(\OCP\Constants::PERMISSION_ALL, 'dir', false, false, 'RDNVCK'),
+ array(\OCP\Constants::PERMISSION_ALL, 'file', true, false, 'SRDNVW'),
+ array(\OCP\Constants::PERMISSION_ALL, 'file', true, true, 'SRMDNVW'),
+ array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_SHARE, 'file', true, false, 'SDNVW'),
+ array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_UPDATE, 'file', false, false, 'RDNV'),
+ array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_DELETE, 'file', false, false, 'RW'),
+ array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_CREATE, 'file', false, false, 'RDNVW'),
+ array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_CREATE, 'dir', false, false, 'RDNV'),
);
}
diff --git a/tests/lib/files/cache/cache.php b/tests/lib/files/cache/cache.php
index 02c45a16571..7360e9885c1 100644
--- a/tests/lib/files/cache/cache.php
+++ b/tests/lib/files/cache/cache.php
@@ -20,20 +20,20 @@ class Cache extends \Test\TestCase {
/**
* @var \OC\Files\Storage\Temporary $storage ;
*/
- private $storage;
+ protected $storage;
/**
* @var \OC\Files\Storage\Temporary $storage2 ;
*/
- private $storage2;
+ protected $storage2;
/**
* @var \OC\Files\Cache\Cache $cache
*/
- private $cache;
+ protected $cache;
/**
* @var \OC\Files\Cache\Cache $cache2
*/
- private $cache2;
+ protected $cache2;
public function testSimple() {
$file1 = 'foo';
diff --git a/tests/lib/files/cache/wrapper/cachejail.php b/tests/lib/files/cache/wrapper/cachejail.php
new file mode 100644
index 00000000000..13f3dc8858e
--- /dev/null
+++ b/tests/lib/files/cache/wrapper/cachejail.php
@@ -0,0 +1,67 @@
+<?php
+/**
+ * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace Test\Files\Cache\Wrapper;
+
+use Test\Files\Cache\Cache;
+
+class CacheJail extends Cache {
+ /**
+ * @var \OC\Files\Cache\Cache $sourceCache
+ */
+ protected $sourceCache;
+
+ public function setUp() {
+ parent::setUp();
+ $this->storage->mkdir('foo');
+ $this->sourceCache = $this->cache;
+ $this->cache = new \OC\Files\Cache\Wrapper\CacheJail($this->sourceCache, 'foo');
+ }
+
+ function testSearchOutsideJail() {
+ $file1 = 'foo/foobar';
+ $file2 = 'folder/foobar';
+ $data1 = array('size' => 100, 'mtime' => 50, 'mimetype' => 'foo/folder');
+
+ $this->sourceCache->put($file1, $data1);
+ $this->sourceCache->put($file2, $data1);
+
+ $this->assertCount(2, $this->sourceCache->search('%foobar'));
+
+ $result = $this->cache->search('%foobar%');
+ $this->assertCount(1, $result);
+ $this->assertEquals('foobar', $result[0]['path']);
+ }
+
+ function testClearKeepEntriesOutsideJail() {
+ $file1 = 'foo/foobar';
+ $file2 = 'foo/foobar/asd';
+ $file3 = 'folder/foobar';
+ $data1 = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory');
+
+ $this->sourceCache->put('foo', $data1);
+ $this->sourceCache->put($file1, $data1);
+ $this->sourceCache->put($file2, $data1);
+ $this->sourceCache->put($file3, $data1);
+
+ $this->cache->clear();
+
+ $this->assertFalse($this->cache->inCache('foobar'));
+ $this->assertTrue($this->sourceCache->inCache('folder/foobar'));
+ }
+
+ function testGetById() {
+ //not supported
+ $this->assertTrue(true);
+ }
+
+ function testGetIncomplete() {
+ //not supported
+ $this->assertTrue(true);
+ }
+}
diff --git a/tests/lib/files/cache/wrapper/cachepermissionsmask.php b/tests/lib/files/cache/wrapper/cachepermissionsmask.php
new file mode 100644
index 00000000000..72fd22741d3
--- /dev/null
+++ b/tests/lib/files/cache/wrapper/cachepermissionsmask.php
@@ -0,0 +1,94 @@
+<?php
+/**
+ * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace Test\Files\Cache\Wrapper;
+
+use OCP\Constants;
+use Test\Files\Cache\Cache;
+
+class CachePermissionsMask extends Cache {
+ /**
+ * @var \OC\Files\Cache\Cache $sourceCache
+ */
+ protected $sourceCache;
+
+ public function setUp() {
+ parent::setUp();
+ $this->storage->mkdir('foo');
+ $this->sourceCache = $this->cache;
+ $this->cache = $this->getMaskedCached(Constants::PERMISSION_ALL);
+ }
+
+ protected function getMaskedCached($mask) {
+ return new \OC\Files\Cache\Wrapper\CachePermissionsMask($this->sourceCache, $mask);
+ }
+
+ public function maskProvider() {
+ return array(
+ array(Constants::PERMISSION_ALL),
+ array(Constants::PERMISSION_ALL - Constants::PERMISSION_SHARE),
+ array(Constants::PERMISSION_ALL - Constants::PERMISSION_UPDATE),
+ array(Constants::PERMISSION_READ)
+ );
+ }
+
+ /**
+ * @dataProvider maskProvider
+ * @param int $mask
+ */
+ public function testGetMasked($mask) {
+ $cache = $this->getMaskedCached($mask);
+ $data = array('size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain', 'permissions' => Constants::PERMISSION_ALL);
+ $this->sourceCache->put('foo', $data);
+ $result = $cache->get('foo');
+ $this->assertEquals($mask, $result['permissions']);
+
+ $data = array('size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain', 'permissions' => Constants::PERMISSION_ALL - Constants::PERMISSION_DELETE);
+ $this->sourceCache->put('bar', $data);
+ $result = $cache->get('bar');
+ $this->assertEquals($mask & ~Constants::PERMISSION_DELETE, $result['permissions']);
+ }
+
+ /**
+ * @dataProvider maskProvider
+ * @param int $mask
+ */
+ public function testGetFolderContentMasked($mask) {
+ $this->storage->mkdir('foo');
+ $this->storage->file_put_contents('foo/bar', 'asd');
+ $this->storage->file_put_contents('foo/asd', 'bar');
+ $this->storage->getScanner()->scan('');
+
+ $cache = $this->getMaskedCached($mask);
+ $files = $cache->getFolderContents('foo');
+ $this->assertCount(2, $files);
+
+ foreach ($files as $file) {
+ $this->assertEquals($mask & ~Constants::PERMISSION_CREATE, $file['permissions']);
+ }
+ }
+
+ /**
+ * @dataProvider maskProvider
+ * @param int $mask
+ */
+ public function testSearchMasked($mask) {
+ $this->storage->mkdir('foo');
+ $this->storage->file_put_contents('foo/bar', 'asd');
+ $this->storage->file_put_contents('foo/foobar', 'bar');
+ $this->storage->getScanner()->scan('');
+
+ $cache = $this->getMaskedCached($mask);
+ $files = $cache->search('%bar');
+ $this->assertCount(2, $files);
+
+ foreach ($files as $file) {
+ $this->assertEquals($mask & ~Constants::PERMISSION_CREATE, $file['permissions']);
+ }
+ }
+}
diff --git a/tests/lib/files/node/file.php b/tests/lib/files/node/file.php
index 34ec7dee213..1ae312ab5a8 100644
--- a/tests/lib/files/node/file.php
+++ b/tests/lib/files/node/file.php
@@ -39,7 +39,7 @@ class File extends \Test\TestCase {
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue(array('permissions' => \OCP\PERMISSION_ALL)));
+ ->will($this->returnValue(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
$view->expects($this->once())
->method('unlink')
@@ -89,7 +89,7 @@ class File extends \Test\TestCase {
$view->expects($this->any())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue(array('permissions' => \OCP\PERMISSION_ALL, 'fileid' => 1)));
+ ->will($this->returnValue(array('permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1)));
$view->expects($this->once())
->method('unlink')
@@ -124,7 +124,7 @@ class File extends \Test\TestCase {
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue(array('permissions' => \OCP\PERMISSION_READ)));
+ ->will($this->returnValue(array('permissions' => \OCP\Constants::PERMISSION_READ)));
$node = new \OC\Files\Node\File($root, $view, '/bar/foo');
$node->delete();
@@ -156,7 +156,7 @@ class File extends \Test\TestCase {
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue(array('permissions' => \OCP\PERMISSION_READ)));
+ ->will($this->returnValue(array('permissions' => \OCP\Constants::PERMISSION_READ)));
$node = new \OC\Files\Node\File($root, $view, '/bar/foo');
$this->assertEquals('bar', $node->getContent());
@@ -201,7 +201,7 @@ class File extends \Test\TestCase {
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue(array('permissions' => \OCP\PERMISSION_ALL)));
+ ->will($this->returnValue(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
$view->expects($this->once())
->method('file_put_contents')
@@ -226,7 +226,7 @@ class File extends \Test\TestCase {
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue(array('permissions' => \OCP\PERMISSION_READ)));
+ ->will($this->returnValue(array('permissions' => \OCP\Constants::PERMISSION_READ)));
$node = new \OC\Files\Node\File($root, $view, '/bar/foo');
$node->putContent('bar');
@@ -279,7 +279,7 @@ class File extends \Test\TestCase {
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue(array('permissions' => \OCP\PERMISSION_ALL)));
+ ->will($this->returnValue(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
$node = new \OC\Files\Node\File($root, $view, '/bar/foo');
$fh = $node->fopen('r');
@@ -316,7 +316,7 @@ class File extends \Test\TestCase {
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue(array('permissions' => \OCP\PERMISSION_ALL)));
+ ->will($this->returnValue(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
$node = new \OC\Files\Node\File($root, $view, '/bar/foo');
$fh = $node->fopen('w');
@@ -375,7 +375,7 @@ class File extends \Test\TestCase {
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue(array('permissions' => \OCP\PERMISSION_UPDATE)));
+ ->will($this->returnValue(array('permissions' => \OCP\Constants::PERMISSION_UPDATE)));
$node = new \OC\Files\Node\File($root, $view, '/bar/foo');
$node->fopen('w');
@@ -402,7 +402,7 @@ class File extends \Test\TestCase {
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue(array('permissions' => \OCP\PERMISSION_READ)));
+ ->will($this->returnValue(array('permissions' => \OCP\Constants::PERMISSION_READ)));
$node = new \OC\Files\Node\File($root, $view, '/bar/foo');
$node->fopen('w');
@@ -425,7 +425,7 @@ class File extends \Test\TestCase {
$view->expects($this->any())
->method('getFileInfo')
- ->will($this->returnValue(array('permissions' => \OCP\PERMISSION_ALL, 'fileid' => 3)));
+ ->will($this->returnValue(array('permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 3)));
$node = new \OC\Files\Node\File($root, $view, '/bar/foo');
$parentNode = new \OC\Files\Node\Folder($root, $view, '/bar');
@@ -469,7 +469,7 @@ class File extends \Test\TestCase {
$view->expects($this->any())
->method('getFileInfo')
- ->will($this->returnValue(array('permissions' => \OCP\PERMISSION_READ, 'fileid' => 3)));
+ ->will($this->returnValue(array('permissions' => \OCP\Constants::PERMISSION_READ, 'fileid' => 3)));
$node = new \OC\Files\Node\File($root, $view, '/bar/foo');
$parentNode = new \OC\Files\Node\Folder($root, $view, '/bar');
@@ -556,7 +556,7 @@ class File extends \Test\TestCase {
$view->expects($this->any())
->method('getFileInfo')
- ->will($this->returnValue(array('permissions' => \OCP\PERMISSION_ALL, 'fileid' => 1)));
+ ->will($this->returnValue(array('permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1)));
$node = new \OC\Files\Node\File($root, $view, '/bar/foo');
$parentNode = new \OC\Files\Node\Folder($root, $view, '/bar');
@@ -587,7 +587,7 @@ class File extends \Test\TestCase {
$view->expects($this->any())
->method('getFileInfo')
- ->will($this->returnValue(array('permissions' => \OCP\PERMISSION_READ)));
+ ->will($this->returnValue(array('permissions' => \OCP\Constants::PERMISSION_READ)));
$view->expects($this->never())
->method('rename');
diff --git a/tests/lib/files/node/folder.php b/tests/lib/files/node/folder.php
index e348e452f6f..91aa3b82db2 100644
--- a/tests/lib/files/node/folder.php
+++ b/tests/lib/files/node/folder.php
@@ -39,7 +39,7 @@ class Folder extends \Test\TestCase {
$view->expects($this->any())
->method('getFileInfo')
- ->will($this->returnValue(array('permissions' => \OCP\PERMISSION_ALL)));
+ ->will($this->returnValue(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
$view->expects($this->once())
->method('rmdir')
@@ -87,7 +87,7 @@ class Folder extends \Test\TestCase {
$view->expects($this->any())
->method('getFileInfo')
- ->will($this->returnValue(array('permissions' => \OCP\PERMISSION_ALL, 'fileid' => 1)));
+ ->will($this->returnValue(array('permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1)));
$view->expects($this->once())
->method('rmdir')
@@ -121,7 +121,7 @@ class Folder extends \Test\TestCase {
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue(array('permissions' => \OCP\PERMISSION_READ)));
+ ->will($this->returnValue(array('permissions' => \OCP\Constants::PERMISSION_READ)));
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$node->delete();
@@ -255,7 +255,7 @@ class Folder extends \Test\TestCase {
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue(array('permissions' => \OCP\PERMISSION_ALL)));
+ ->will($this->returnValue(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
$view->expects($this->once())
->method('mkdir')
@@ -285,7 +285,7 @@ class Folder extends \Test\TestCase {
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue(array('permissions' => \OCP\PERMISSION_READ)));
+ ->will($this->returnValue(array('permissions' => \OCP\Constants::PERMISSION_READ)));
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$node->newFolder('asd');
@@ -305,7 +305,7 @@ class Folder extends \Test\TestCase {
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue(array('permissions' => \OCP\PERMISSION_ALL)));
+ ->will($this->returnValue(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
$view->expects($this->once())
->method('touch')
@@ -335,7 +335,7 @@ class Folder extends \Test\TestCase {
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue(array('permissions' => \OCP\PERMISSION_READ)));
+ ->will($this->returnValue(array('permissions' => \OCP\Constants::PERMISSION_READ)));
$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
$node->newFile('asd');
diff --git a/tests/lib/files/node/node.php b/tests/lib/files/node/node.php
index 80e3ac6f80a..8820be5b0b2 100644
--- a/tests/lib/files/node/node.php
+++ b/tests/lib/files/node/node.php
@@ -246,7 +246,7 @@ class Node extends \Test\TestCase {
$view->expects($this->once())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue(array('permissions' => \OCP\PERMISSION_ALL)));
+ ->will($this->returnValue(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
$node = new \OC\Files\Node\Node($root, $view, '/bar/foo');
$node->touch(100);
@@ -299,7 +299,7 @@ class Node extends \Test\TestCase {
$view->expects($this->any())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue(array('permissions' => \OCP\PERMISSION_ALL)));
+ ->will($this->returnValue(array('permissions' => \OCP\Constants::PERMISSION_ALL)));
$node = new \OC\Files\Node\Node($root, $view, '/bar/foo');
$node->touch(100);
@@ -323,7 +323,7 @@ class Node extends \Test\TestCase {
$view->expects($this->any())
->method('getFileInfo')
->with('/bar/foo')
- ->will($this->returnValue(array('permissions' => \OCP\PERMISSION_READ)));
+ ->will($this->returnValue(array('permissions' => \OCP\Constants::PERMISSION_READ)));
$node = new \OC\Files\Node\Node($root, $view, '/bar/foo');
$node->touch(100);
diff --git a/tests/lib/files/storage/wrapper/jail.php b/tests/lib/files/storage/wrapper/jail.php
new file mode 100644
index 00000000000..270ce750ecf
--- /dev/null
+++ b/tests/lib/files/storage/wrapper/jail.php
@@ -0,0 +1,55 @@
+<?php
+/**
+ * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace Test\Files\Storage\Wrapper;
+
+class Jail extends \Test\Files\Storage\Storage {
+ /**
+ * @var string tmpDir
+ */
+ private $tmpDir;
+
+ /**
+ * @var \OC\Files\Storage\Temporary
+ */
+ private $sourceStorage;
+
+ public function setUp() {
+ parent::setUp();
+ $this->sourceStorage = new \OC\Files\Storage\Temporary(array());
+ $this->sourceStorage->mkdir('foo');
+ $this->instance = new \OC\Files\Storage\Wrapper\Jail(array(
+ 'storage' => $this->sourceStorage,
+ 'root' => 'foo'
+ ));
+ }
+
+ public function tearDown() {
+ // test that nothing outside our jail is touched
+ $contents = array();
+ $dh = $this->sourceStorage->opendir('');
+ while ($file = readdir($dh)) {
+ if ($file !== '.' and $file !== '..') {
+ $contents[] = $file;
+ }
+ }
+ $this->assertEquals(array('foo'), $contents);
+ $this->sourceStorage->cleanUp();
+ parent::tearDown();
+ }
+
+ public function testMkDirRooted() {
+ $this->instance->mkdir('bar');
+ $this->assertTrue($this->sourceStorage->is_dir('foo/bar'));
+ }
+
+ public function testFilePutContentsRooted() {
+ $this->instance->file_put_contents('bar', 'asd');
+ $this->assertEquals('asd', $this->sourceStorage->file_get_contents('foo/bar'));
+ }
+}
diff --git a/tests/lib/files/storage/wrapper/permissionsmask.php b/tests/lib/files/storage/wrapper/permissionsmask.php
new file mode 100644
index 00000000000..7e8c387677c
--- /dev/null
+++ b/tests/lib/files/storage/wrapper/permissionsmask.php
@@ -0,0 +1,105 @@
+<?php
+/**
+ * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace Test\Files\Storage\Wrapper;
+
+use OCP\Constants;
+
+class PermissionsMask extends \Test\Files\Storage\Storage {
+
+ /**
+ * @var \OC\Files\Storage\Temporary
+ */
+ private $sourceStorage;
+
+ public function setUp() {
+ parent::setUp();
+ $this->sourceStorage = new \OC\Files\Storage\Temporary(array());
+ $this->instance = $this->getMaskedStorage(Constants::PERMISSION_ALL);
+ }
+
+ public function tearDown() {
+ $this->sourceStorage->cleanUp();
+ parent::tearDown();
+ }
+
+ protected function getMaskedStorage($mask) {
+ return new \OC\Files\Storage\Wrapper\PermissionsMask(array(
+ 'storage' => $this->sourceStorage,
+ 'mask' => $mask
+ ));
+ }
+
+ public function testMkdirNoCreate() {
+ $storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE);
+ $this->assertFalse($storage->mkdir('foo'));
+ $this->assertFalse($storage->file_exists('foo'));
+ }
+
+ public function testRmdirNoDelete() {
+ $storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_DELETE);
+ $this->assertTrue($storage->mkdir('foo'));
+ $this->assertTrue($storage->file_exists('foo'));
+ $this->assertFalse($storage->rmdir('foo'));
+ $this->assertTrue($storage->file_exists('foo'));
+ }
+
+ public function testTouchNewFileNoCreate() {
+ $storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE);
+ $this->assertFalse($storage->touch('foo'));
+ $this->assertFalse($storage->file_exists('foo'));
+ }
+
+ public function testTouchNewFileNoUpdate() {
+ $storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_UPDATE);
+ $this->assertTrue($storage->touch('foo'));
+ $this->assertTrue($storage->file_exists('foo'));
+ }
+
+ public function testTouchExistingFileNoUpdate() {
+ $this->sourceStorage->touch('foo');
+ $storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_UPDATE);
+ $this->assertFalse($storage->touch('foo'));
+ }
+
+ public function testUnlinkNoDelete() {
+ $storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_DELETE);
+ $this->assertTrue($storage->touch('foo'));
+ $this->assertTrue($storage->file_exists('foo'));
+ $this->assertFalse($storage->unlink('foo'));
+ $this->assertTrue($storage->file_exists('foo'));
+ }
+
+ public function testPutContentsNewFileNoUpdate() {
+ $storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_UPDATE);
+ $this->assertTrue($storage->file_put_contents('foo', 'bar'));
+ $this->assertEquals('bar', $storage->file_get_contents('foo'));
+ }
+
+ public function testPutContentsNewFileNoCreate() {
+ $storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE);
+ $this->assertFalse($storage->file_put_contents('foo', 'bar'));
+ }
+
+ public function testPutContentsExistingFileNoUpdate() {
+ $this->sourceStorage->touch('foo');
+ $storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_UPDATE);
+ $this->assertFalse($storage->file_put_contents('foo', 'bar'));
+ }
+
+ public function testFopenExistingFileNoUpdate() {
+ $this->sourceStorage->touch('foo');
+ $storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_UPDATE);
+ $this->assertFalse($storage->fopen('foo', 'w'));
+ }
+
+ public function testFopenNewFileNoCreate() {
+ $storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE);
+ $this->assertFalse($storage->fopen('foo', 'w'));
+ }
+}
diff --git a/tests/lib/migrate.php b/tests/lib/migrate.php
deleted file mode 100644
index 9c1e980c445..00000000000
--- a/tests/lib/migrate.php
+++ /dev/null
@@ -1,98 +0,0 @@
-<?php
-/**
- * Copyright (c) 2014 Tom Needham <tom@owncloud.com>
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
- */
-
-class Test_Migrate extends \Test\TestCase {
-
- public $users;
- public $tmpfiles = array();
-
- /** @var \OC\Files\Storage\Storage */
- private $originalStorage;
-
- protected function setUp() {
- parent::setUp();
-
- $this->originalStorage = \OC\Files\Filesystem::getStorage('/');
- }
-
- protected function tearDown() {
- $u = new OC_User();
- foreach($this->users as $user) {
- $u->deleteUser($user);
- }
- foreach($this->tmpfiles as $file) {
- \OC_Helper::rmdirr($file);
- }
-
- \OC\Files\Filesystem::mount($this->originalStorage, array(), '/');
- parent::tearDown();
- }
-
- /**
- * Generates a test user and sets up their file system
- * @return string the test users id
- */
- public function generateUser() {
- $username = $this->getUniqueID();
- \OC_User::createUser($username, 'password');
- \OC_Util::tearDownFS();
- \OC_User::setUserId('');
- \OC\Files\Filesystem::tearDown();
- \OC_Util::setupFS($username);
- $this->users[] = $username;
- return $username;
- }
-
- /**
- * validates an export for a user
- * checks for existence of export_info.json and file folder
- * @param string $exportedUser the user that was exported
- * @param string $path the path to the .zip export
- * @param string $exportedBy
- */
- public function validateUserExport($exportedBy, $exportedUser, $path) {
- $this->assertTrue(file_exists($path));
- // Extract
- $extract = get_temp_dir() . '/oc_import_' . uniqid();
- //mkdir($extract);
- $this->tmpfiles[] = $extract;
- $zip = new ZipArchive;
- $zip->open($path);
- $zip->extractTo($extract);
- $zip->close();
- $this->assertTrue(file_exists($extract.'/export_info.json'));
- $exportInfo = file_get_contents($extract.'/export_info.json');
- $exportInfo = json_decode($exportInfo);
- $this->assertNotNull($exportInfo);
- $this->assertEquals($exportedUser, $exportInfo->exporteduser);
- $this->assertEquals($exportedBy, $exportInfo->exportedby);
- $this->assertTrue(file_exists($extract.'/'.$exportedUser.'/files'));
- }
-
- public function testUserSelfExport() {
- // Create a user
- $user = $this->generateUser();
- \OC_User::setUserId($user);
- $export = \OC_Migrate::export($user);
- // Check it succeeded and exists
- $this->assertTrue(json_decode($export)->success);
- // Validate the export
- $this->validateUserExport($user, $user, json_decode($export)->data);
- }
-
- public function testUserOtherExport() {
- $user = $this->generateUser();
- $user2 = $this->generateUser();
- \OC_User::setUserId($user2);
- $export = \OC_Migrate::export($user);
- // Check it succeeded and exists
- $this->assertTrue(json_decode($export)->success);
- // Validate the export
- $this->validateUserExport($user2, $user, json_decode($export)->data);
- }
-}
diff --git a/tests/lib/share/backend.php b/tests/lib/share/backend.php
index 61b8f262a42..07958266947 100644
--- a/tests/lib/share/backend.php
+++ b/tests/lib/share/backend.php
@@ -19,8 +19,6 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-OC::$CLASSPATH['OCP\Share_Backend']='lib/public/share.php';
-
class Test_Share_Backend implements OCP\Share_Backend {
const FORMAT_SOURCE = 0;
diff --git a/tests/lib/share/helper.php b/tests/lib/share/helper.php
index 76046d360bc..7a546410aea 100644
--- a/tests/lib/share/helper.php
+++ b/tests/lib/share/helper.php
@@ -27,8 +27,8 @@ class Test_Share_Helper extends \Test\TestCase {
array(array('defaultExpireDateSet' => false), 2000000000, 2000010000, 2000010000),
// no default expire date and no user defined expire date, return false
array(array('defaultExpireDateSet' => false), 2000000000, null, false),
- // unenforced expire data and no user defined expire date, take default expire date
- array(array('defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => false), 2000000000, null, 2000086400),
+ // unenforced expire data and no user defined expire date, return false (because the default is not enforced)
+ array(array('defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => false), 2000000000, null, false),
// enforced expire date and no user defined expire date, take default expire date
array(array('defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => true), 2000000000, null, 2000086400),
// unenforced expire date and user defined date > default expire date, take users expire date
@@ -49,6 +49,4 @@ class Test_Share_Helper extends \Test\TestCase {
$result = \OC\Share\Helper::calculateExpireDate($defaultExpireSettings, $creationTime, $userExpireDate);
$this->assertSame($expected, $result);
}
-
-
}
diff --git a/tests/lib/share/share.php b/tests/lib/share/share.php
index b5cdab0025b..1f95502919d 100644
--- a/tests/lib/share/share.php
+++ b/tests/lib/share/share.php
@@ -89,7 +89,7 @@ class Test_Share extends \Test\TestCase {
public function testShareInvalidShareType() {
$message = 'Share type foobar is not valid for test.txt';
try {
- OCP\Share::shareItem('test', 'test.txt', 'foobar', $this->user2, OCP\PERMISSION_READ);
+ OCP\Share::shareItem('test', 'test.txt', 'foobar', $this->user2, \OCP\Constants::PERMISSION_READ);
} catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
}
@@ -98,7 +98,7 @@ class Test_Share extends \Test\TestCase {
public function testInvalidItemType() {
$message = 'Sharing backend for foobar not found';
try {
- OCP\Share::shareItem('foobar', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_READ);
+ OCP\Share::shareItem('foobar', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ);
$this->fail('Exception was expected: '.$message);
} catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
@@ -134,7 +134,7 @@ class Test_Share extends \Test\TestCase {
$this->assertEquals($message, $exception->getMessage());
}
try {
- OCP\Share::setPermissions('foobar', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_UPDATE);
+ OCP\Share::setPermissions('foobar', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_UPDATE);
$this->fail('Exception was expected: '.$message);
} catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
@@ -144,7 +144,7 @@ class Test_Share extends \Test\TestCase {
protected function shareUserOneTestFileWithUserTwo() {
OC_User::setUserId($this->user1);
$this->assertTrue(
- OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_READ),
+ OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ),
'Failed asserting that user 1 successfully shared text.txt with user 2.'
);
$this->assertContains(
@@ -163,7 +163,7 @@ class Test_Share extends \Test\TestCase {
protected function shareUserTestFileAsLink() {
OC_User::setUserId($this->user1);
- $result = OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_LINK, null, OCP\PERMISSION_READ);
+ $result = OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_LINK, null, \OCP\Constants::PERMISSION_READ);
$this->assertTrue(is_string($result));
}
@@ -174,7 +174,7 @@ class Test_Share extends \Test\TestCase {
protected function shareUserTestFileWithUser($sharer, $receiver) {
OC_User::setUserId($sharer);
$this->assertTrue(
- OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $receiver, OCP\PERMISSION_READ | OCP\PERMISSION_SHARE),
+ OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $receiver, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE),
'Failed asserting that ' . $sharer . ' successfully shared text.txt with ' . $receiver . '.'
);
$this->assertContains(
@@ -195,21 +195,21 @@ class Test_Share extends \Test\TestCase {
// Invalid shares
$message = 'Sharing test.txt failed, because the user '.$this->user1.' is the item owner';
try {
- OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user1, OCP\PERMISSION_READ);
+ OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user1, \OCP\Constants::PERMISSION_READ);
$this->fail('Exception was expected: '.$message);
} catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
}
$message = 'Sharing test.txt failed, because the user foobar does not exist';
try {
- OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, 'foobar', OCP\PERMISSION_READ);
+ OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, 'foobar', \OCP\Constants::PERMISSION_READ);
$this->fail('Exception was expected: '.$message);
} catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
}
$message = 'Sharing foobar failed, because the sharing backend for test could not find its source';
try {
- OCP\Share::shareItem('test', 'foobar', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_READ);
+ OCP\Share::shareItem('test', 'foobar', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ);
$this->fail('Exception was expected: '.$message);
} catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
@@ -222,7 +222,7 @@ class Test_Share extends \Test\TestCase {
OC_User::setUserId($this->user1);
$message = 'Sharing test.txt failed, because this item is already shared with '.$this->user2;
try {
- OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_READ);
+ OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ);
$this->fail('Exception was expected: '.$message);
} catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
@@ -232,7 +232,7 @@ class Test_Share extends \Test\TestCase {
OC_User::setUserId($this->user2);
$message = 'Sharing test.txt failed, because the user '.$this->user1.' is the original sharer';
try {
- OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user1, OCP\PERMISSION_READ);
+ OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user1, \OCP\Constants::PERMISSION_READ);
$this->fail('Exception was expected: '.$message);
} catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
@@ -243,11 +243,11 @@ class Test_Share extends \Test\TestCase {
$this->assertTrue(OCP\Share::unshare('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2));
// Attempt reshare without share permission
- $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_READ));
+ $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ));
OC_User::setUserId($this->user2);
$message = 'Sharing test.txt failed, because resharing is not allowed';
try {
- OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, OCP\PERMISSION_READ);
+ OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ);
$this->fail('Exception was expected: '.$message);
} catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
@@ -255,30 +255,30 @@ class Test_Share extends \Test\TestCase {
// Owner grants share and update permission
OC_User::setUserId($this->user1);
- $this->assertTrue(OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_READ | OCP\PERMISSION_UPDATE | OCP\PERMISSION_SHARE));
+ $this->assertTrue(OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE));
// Attempt reshare with escalated permissions
OC_User::setUserId($this->user2);
$message = 'Sharing test.txt failed, because the permissions exceed permissions granted to '.$this->user2;
try {
- OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, OCP\PERMISSION_READ | OCP\PERMISSION_DELETE);
+ OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_DELETE);
$this->fail('Exception was expected: '.$message);
} catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
}
// Valid reshare
- $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, OCP\PERMISSION_READ | OCP\PERMISSION_UPDATE));
+ $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE));
$this->assertEquals(array('test.txt'), OCP\Share::getItemShared('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE));
OC_User::setUserId($this->user3);
$this->assertEquals(array('test.txt'), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE));
- $this->assertEquals(array(OCP\PERMISSION_READ | OCP\PERMISSION_UPDATE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
+ $this->assertEquals(array(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
// Attempt to escalate permissions
OC_User::setUserId($this->user2);
$message = 'Setting permissions for test.txt failed, because the permissions exceed permissions granted to '.$this->user2;
try {
- OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, OCP\PERMISSION_READ | OCP\PERMISSION_DELETE);
+ OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_DELETE);
$this->fail('Exception was expected: '.$message);
} catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
@@ -286,25 +286,25 @@ class Test_Share extends \Test\TestCase {
// Remove update permission
OC_User::setUserId($this->user1);
- $this->assertTrue(OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_READ | OCP\PERMISSION_SHARE));
+ $this->assertTrue(OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE));
OC_User::setUserId($this->user2);
- $this->assertEquals(array(OCP\PERMISSION_READ | OCP\PERMISSION_SHARE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
+ $this->assertEquals(array(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
OC_User::setUserId($this->user3);
- $this->assertEquals(array(OCP\PERMISSION_READ), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
+ $this->assertEquals(array(\OCP\Constants::PERMISSION_READ), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
// Remove share permission
OC_User::setUserId($this->user1);
- $this->assertTrue(OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_READ));
+ $this->assertTrue(OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ));
OC_User::setUserId($this->user2);
- $this->assertEquals(array(OCP\PERMISSION_READ), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
+ $this->assertEquals(array(\OCP\Constants::PERMISSION_READ), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
OC_User::setUserId($this->user3);
$this->assertSame(array(), OCP\Share::getItemSharedWith('test', 'test.txt'));
// Reshare again, and then have owner unshare
OC_User::setUserId($this->user1);
- $this->assertTrue(OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_READ | OCP\PERMISSION_SHARE));
+ $this->assertTrue(OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE));
OC_User::setUserId($this->user2);
- $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, OCP\PERMISSION_READ));
+ $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ));
OC_User::setUserId($this->user1);
$this->assertTrue(OCP\Share::unshare('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2));
OC_User::setUserId($this->user2);
@@ -314,9 +314,9 @@ class Test_Share extends \Test\TestCase {
// Attempt target conflict
OC_User::setUserId($this->user1);
- $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_READ));
+ $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ));
OC_User::setUserId($this->user3);
- $this->assertTrue(OCP\Share::shareItem('test', 'share.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_READ));
+ $this->assertTrue(OCP\Share::shareItem('test', 'share.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ));
OC_User::setUserId($this->user2);
$to_test = OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET);
@@ -333,9 +333,9 @@ class Test_Share extends \Test\TestCase {
$this->assertEquals(array(), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
OC_User::setUserId($this->user1);
- $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_READ));
+ $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ));
OC_User::setUserId($this->user3);
- $this->assertTrue(OCP\Share::shareItem('test', 'share.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_READ));
+ $this->assertTrue(OCP\Share::shareItem('test', 'share.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ));
OC_User::setUserId($this->user2);
$to_test = OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET);
@@ -412,7 +412,7 @@ class Test_Share extends \Test\TestCase {
OC_User::setUserId($this->user1);
$this->assertTrue(
- OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user4, OCP\PERMISSION_ALL),
+ OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user4, \OCP\Constants::PERMISSION_ALL),
'Failed asserting that user 1 successfully shared text.txt with user 4.'
);
$this->assertContains(
@@ -429,7 +429,7 @@ class Test_Share extends \Test\TestCase {
$share = OCP\Share::getItemSharedWith('test', 'test.txt');
- $this->assertSame(\OCP\PERMISSION_ALL & ~OCP\PERMISSION_SHARE, $share['permissions'],
+ $this->assertSame(\OCP\Constants::PERMISSION_ALL & ~\OCP\Constants::PERMISSION_SHARE, $share['permissions'],
'Failed asserting that user 4 is excluded from re-sharing');
\OC_Appconfig::deleteKey('core', 'shareapi_exclude_groups_list');
@@ -440,7 +440,7 @@ class Test_Share extends \Test\TestCase {
protected function shareUserOneTestFileWithGroupOne() {
OC_User::setUserId($this->user1);
$this->assertTrue(
- OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1, OCP\PERMISSION_READ),
+ OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1, \OCP\Constants::PERMISSION_READ),
'Failed asserting that user 1 successfully shared text.txt with group 1.'
);
$this->assertContains(
@@ -468,7 +468,7 @@ class Test_Share extends \Test\TestCase {
// Invalid shares
$message = 'Sharing test.txt failed, because the group foobar does not exist';
try {
- OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, 'foobar', OCP\PERMISSION_READ);
+ OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, 'foobar', \OCP\Constants::PERMISSION_READ);
$this->fail('Exception was expected: '.$message);
} catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
@@ -477,7 +477,7 @@ class Test_Share extends \Test\TestCase {
OC_Appconfig::setValue('core', 'shareapi_only_share_with_group_members', 'yes');
$message = 'Sharing test.txt failed, because '.$this->user1.' is not a member of the group '.$this->group2;
try {
- OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group2, OCP\PERMISSION_READ);
+ OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group2, \OCP\Constants::PERMISSION_READ);
$this->fail('Exception was expected: '.$message);
} catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
@@ -491,7 +491,7 @@ class Test_Share extends \Test\TestCase {
OC_User::setUserId($this->user1);
$message = 'Sharing test.txt failed, because this item is already shared with '.$this->group1;
try {
- OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1, OCP\PERMISSION_READ);
+ OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1, \OCP\Constants::PERMISSION_READ);
$this->fail('Exception was expected: '.$message);
} catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
@@ -501,7 +501,7 @@ class Test_Share extends \Test\TestCase {
OC_User::setUserId($this->user2);
$message = 'Sharing test.txt failed, because the user '.$this->user1.' is the original sharer';
try {
- OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user1, OCP\PERMISSION_READ);
+ OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user1, \OCP\Constants::PERMISSION_READ);
$this->fail('Exception was expected: '.$message);
} catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
@@ -510,7 +510,7 @@ class Test_Share extends \Test\TestCase {
// Attempt to share back to group
$message = 'Sharing test.txt failed, because this item is already shared with '.$this->group1;
try {
- OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1, OCP\PERMISSION_READ);
+ OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1, \OCP\Constants::PERMISSION_READ);
$this->fail('Exception was expected: '.$message);
} catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
@@ -519,7 +519,7 @@ class Test_Share extends \Test\TestCase {
// Attempt to share back to member of group
$message ='Sharing test.txt failed, because this item is already shared with '.$this->user3;
try {
- OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, OCP\PERMISSION_READ);
+ OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ);
$this->fail('Exception was expected: '.$message);
} catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
@@ -530,18 +530,18 @@ class Test_Share extends \Test\TestCase {
$this->assertTrue(OCP\Share::unshare('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1));
// Valid share with same person - user then group
- $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_READ | OCP\PERMISSION_DELETE | OCP\PERMISSION_SHARE));
- $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1, OCP\PERMISSION_READ | OCP\PERMISSION_UPDATE));
+ $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_DELETE | \OCP\Constants::PERMISSION_SHARE));
+ $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE));
OC_User::setUserId($this->user2);
$this->assertEquals(array('test.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
- $this->assertEquals(array(OCP\PERMISSION_READ | OCP\PERMISSION_UPDATE | OCP\PERMISSION_DELETE | OCP\PERMISSION_SHARE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
+ $this->assertEquals(array(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE | \OCP\Constants::PERMISSION_SHARE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
OC_User::setUserId($this->user3);
$this->assertEquals(array('test.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
- $this->assertEquals(array(OCP\PERMISSION_READ | OCP\PERMISSION_UPDATE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
+ $this->assertEquals(array(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
// Valid reshare
OC_User::setUserId($this->user2);
- $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user4, OCP\PERMISSION_READ));
+ $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user4, \OCP\Constants::PERMISSION_READ));
OC_User::setUserId($this->user4);
$this->assertEquals(array('test.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
@@ -549,26 +549,26 @@ class Test_Share extends \Test\TestCase {
OC_User::setUserId($this->user1);
$this->assertTrue(OCP\Share::unshare('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2));
OC_User::setUserId($this->user2);
- $this->assertEquals(array(OCP\PERMISSION_READ | OCP\PERMISSION_UPDATE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
+ $this->assertEquals(array(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
OC_User::setUserId($this->user4);
$this->assertEquals(array('test.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
// Valid share with same person - group then user
OC_User::setUserId($this->user1);
- $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_READ | OCP\PERMISSION_DELETE));
+ $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_DELETE));
OC_User::setUserId($this->user2);
$this->assertEquals(array('test.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
- $this->assertEquals(array(OCP\PERMISSION_READ | OCP\PERMISSION_UPDATE | OCP\PERMISSION_DELETE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
+ $this->assertEquals(array(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
// Unshare from group only
OC_User::setUserId($this->user1);
$this->assertTrue(OCP\Share::unshare('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1));
OC_User::setUserId($this->user2);
- $this->assertEquals(array(OCP\PERMISSION_READ | OCP\PERMISSION_DELETE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
+ $this->assertEquals(array(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_DELETE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
// Attempt user specific target conflict
OC_User::setUserId($this->user3);
- $this->assertTrue(OCP\Share::shareItem('test', 'share.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1, OCP\PERMISSION_READ | OCP\PERMISSION_SHARE));
+ $this->assertTrue(OCP\Share::shareItem('test', 'share.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE));
OC_User::setUserId($this->user2);
$to_test = OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET);
$this->assertEquals(2, count($to_test));
@@ -576,7 +576,7 @@ class Test_Share extends \Test\TestCase {
$this->assertTrue(in_array('test1.txt', $to_test));
// Valid reshare
- $this->assertTrue(OCP\Share::shareItem('test', 'share.txt', OCP\Share::SHARE_TYPE_USER, $this->user4, OCP\PERMISSION_READ | OCP\PERMISSION_SHARE));
+ $this->assertTrue(OCP\Share::shareItem('test', 'share.txt', OCP\Share::SHARE_TYPE_USER, $this->user4, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE));
OC_User::setUserId($this->user4);
$this->assertEquals(array('test1.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
@@ -628,7 +628,7 @@ class Test_Share extends \Test\TestCase {
$this->assertTrue(OCP\Share::unshareAll('test', 'test.txt'));
$this->assertTrue(
- OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->groupAndUser, OCP\PERMISSION_READ),
+ OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->groupAndUser, \OCP\Constants::PERMISSION_READ),
'Failed asserting that user 1 successfully shared text.txt with group 1.'
);
@@ -704,7 +704,7 @@ class Test_Share extends \Test\TestCase {
public function testShareItemWithLink() {
OC_User::setUserId($this->user1);
- $token = OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_LINK, null, OCP\PERMISSION_READ);
+ $token = OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_LINK, null, \OCP\Constants::PERMISSION_READ);
$this->assertInternalType(
'string',
$token,
@@ -750,7 +750,7 @@ class Test_Share extends \Test\TestCase {
\OC_Appconfig::setValue('core', 'shareapi_default_expire_date', 'yes');
\OC_Appconfig::setValue('core', 'shareapi_expire_after_n_days', '2');
- $token = OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_LINK, null, OCP\PERMISSION_READ);
+ $token = OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_LINK, null, \OCP\Constants::PERMISSION_READ);
$this->assertInternalType(
'string',
$token,
@@ -876,20 +876,20 @@ class Test_Share extends \Test\TestCase {
// one array with one share
array(
array( // input
- array('item_source' => 1, 'permissions' => \OCP\PERMISSION_ALL, 'item_target' => 't1')),
+ array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_ALL, 'item_target' => 't1')),
array( // expected result
- array('item_source' => 1, 'permissions' => \OCP\PERMISSION_ALL, 'item_target' => 't1'))),
+ array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_ALL, 'item_target' => 't1'))),
// two shares both point to the same source
array(
array( // input
- array('item_source' => 1, 'permissions' => \OCP\PERMISSION_READ, 'item_target' => 't1'),
- array('item_source' => 1, 'permissions' => \OCP\PERMISSION_UPDATE, 'item_target' => 't1'),
+ array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ, 'item_target' => 't1'),
+ array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't1'),
),
array( // expected result
- array('item_source' => 1, 'permissions' => \OCP\PERMISSION_READ | \OCP\PERMISSION_UPDATE, 'item_target' => 't1',
+ array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't1',
'grouped' => array(
- array('item_source' => 1, 'permissions' => \OCP\PERMISSION_READ, 'item_target' => 't1'),
- array('item_source' => 1, 'permissions' => \OCP\PERMISSION_UPDATE, 'item_target' => 't1'),
+ array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ, 'item_target' => 't1'),
+ array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't1'),
)
),
)
@@ -897,29 +897,29 @@ class Test_Share extends \Test\TestCase {
// two shares both point to the same source but with different targets
array(
array( // input
- array('item_source' => 1, 'permissions' => \OCP\PERMISSION_READ, 'item_target' => 't1'),
- array('item_source' => 1, 'permissions' => \OCP\PERMISSION_UPDATE, 'item_target' => 't2'),
+ array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ, 'item_target' => 't1'),
+ array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't2'),
),
array( // expected result
- array('item_source' => 1, 'permissions' => \OCP\PERMISSION_READ, 'item_target' => 't1'),
- array('item_source' => 1, 'permissions' => \OCP\PERMISSION_UPDATE, 'item_target' => 't2'),
+ array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ, 'item_target' => 't1'),
+ array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't2'),
)
),
// three shares two point to the same source
array(
array( // input
- array('item_source' => 1, 'permissions' => \OCP\PERMISSION_READ, 'item_target' => 't1'),
- array('item_source' => 2, 'permissions' => \OCP\PERMISSION_CREATE, 'item_target' => 't2'),
- array('item_source' => 1, 'permissions' => \OCP\PERMISSION_UPDATE, 'item_target' => 't1'),
+ array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ, 'item_target' => 't1'),
+ array('item_source' => 2, 'permissions' => \OCP\Constants::PERMISSION_CREATE, 'item_target' => 't2'),
+ array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't1'),
),
array( // expected result
- array('item_source' => 1, 'permissions' => \OCP\PERMISSION_READ | \OCP\PERMISSION_UPDATE, 'item_target' => 't1',
+ array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't1',
'grouped' => array(
- array('item_source' => 1, 'permissions' => \OCP\PERMISSION_READ, 'item_target' => 't1'),
- array('item_source' => 1, 'permissions' => \OCP\PERMISSION_UPDATE, 'item_target' => 't1'),
+ array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ, 'item_target' => 't1'),
+ array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't1'),
)
),
- array('item_source' => 2, 'permissions' => \OCP\PERMISSION_CREATE, 'item_target' => 't2'),
+ array('item_source' => 2, 'permissions' => \OCP\Constants::PERMISSION_CREATE, 'item_target' => 't2'),
)
),
);
diff --git a/tests/lib/tags.php b/tests/lib/tags.php
index ab714bde3df..3f0c52d19ea 100644
--- a/tests/lib/tags.php
+++ b/tests/lib/tags.php
@@ -214,7 +214,7 @@ class Test_Tags extends \Test\TestCase {
$this->assertFalse($other_tagger->hasTag($test_tag));
OC_User::setUserId($this->user);
- OCP\Share::shareItem('test', 1, OCP\Share::SHARE_TYPE_USER, $other_user, OCP\PERMISSION_READ);
+ OCP\Share::shareItem('test', 1, OCP\Share::SHARE_TYPE_USER, $other_user, \OCP\Constants::PERMISSION_READ);
OC_User::setUserId($other_user);
$other_tagger = $other_tagMgr->load('test', array(), true); // Update tags, load shared ones.
diff --git a/tests/lib/tempmanager.php b/tests/lib/tempmanager.php
index 05311e820a7..c030eef2c9e 100644
--- a/tests/lib/tempmanager.php
+++ b/tests/lib/tempmanager.php
@@ -27,7 +27,7 @@ class TempManager extends \Test\TestCase {
protected function setUp() {
parent::setUp();
- $this->baseDir = get_temp_dir() . '/oc_tmp_test';
+ $this->baseDir = get_temp_dir() . $this->getUniqueID('/oc_tmp_test');
if (!is_dir($this->baseDir)) {
mkdir($this->baseDir);
}
@@ -39,7 +39,7 @@ class TempManager extends \Test\TestCase {
}
/**
- * @param \Psr\Log\LoggerInterface $logger
+ * @param \OCP\ILogger $logger
* @return \OC\TempManager
*/
protected function getManager($logger = null) {
diff --git a/tests/lib/testcase.php b/tests/lib/testcase.php
index e6f5ca71dac..934bc5fa8f3 100644
--- a/tests/lib/testcase.php
+++ b/tests/lib/testcase.php
@@ -64,7 +64,7 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase {
/**
* Remove all entries from the storages table
- * @throws \DatabaseException
+ * @throws \OC\DatabaseException
*/
static protected function tearDownAfterClassCleanStorages() {
$sql = 'DELETE FROM `*PREFIX*storages`';
@@ -74,7 +74,7 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase {
/**
* Remove all entries from the filecache table
- * @throws \DatabaseException
+ * @throws \OC\DatabaseException
*/
static protected function tearDownAfterClassCleanFileCache() {
$sql = 'DELETE FROM `*PREFIX*filecache`';
diff --git a/tests/preseed-config.php b/tests/preseed-config.php
index 3fd5b3cb7fc..3f41573bf29 100644
--- a/tests/preseed-config.php
+++ b/tests/preseed-config.php
@@ -1,22 +1,21 @@
<?php
$CONFIG = array (
- "appstoreenabled" => false,
- 'apps_paths' =>
- array (
- 0 =>
- array (
- 'path' => OC::$SERVERROOT.'/apps',
- 'url' => '/apps',
- 'writable' => true,
- ),
- 1 =>
- array (
- 'path' => OC::$SERVERROOT.'/apps2',
- 'url' => '/apps2',
- 'writable' => false,
- )
- ),
-
+ "appstoreenabled" => false,
+ 'apps_paths' =>
+ array (
+ 0 =>
+ array (
+ 'path' => OC::$SERVERROOT.'/apps',
+ 'url' => '/apps',
+ 'writable' => true,
+ ),
+ 1 =>
+ array (
+ 'path' => OC::$SERVERROOT.'/apps2',
+ 'url' => '/apps2',
+ 'writable' => false,
+ )
+ ),
);
if(substr(strtolower(PHP_OS), 0, 3) == "win") {