diff options
Diffstat (limited to 'lib')
278 files changed, 1256 insertions, 992 deletions
diff --git a/lib/base.php b/lib/base.php index 4c96e3470cd..a86dccd0822 100644 --- a/lib/base.php +++ b/lib/base.php @@ -265,7 +265,7 @@ class OC { $l->t('Cannot write into "config" directory!'), $l->t('This can usually be fixed by giving the webserver write access to the config directory.') . '. ' . $l->t('Or, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it. See %s', - [ $urlGenerator->linkToDocs('admin-config') ] ), + [ $urlGenerator->linkToDocs('admin-config') ]), 503 ); } @@ -812,7 +812,7 @@ class OC { // NOTE: This will be replaced to use OCP $userSession = self::$server->getUserSession(); $userSession->listen('\OC\User', 'postLogin', function () use ($userSession) { - if (!defined('PHPUNIT_RUN')) { + if (!defined('PHPUNIT_RUN') && $userSession->isLoggedIn()) { // reset brute force delay for this IP address and username $uid = \OC::$server->getUserSession()->getUser()->getUID(); $request = \OC::$server->getRequest(); @@ -863,7 +863,7 @@ class OC { private static function registerAppRestrictionsHooks() { $groupManager = self::$server->query(\OCP\IGroupManager::class); - $groupManager->listen ('\OC\Group', 'postDelete', function (\OCP\IGroup $group) { + $groupManager->listen('\OC\Group', 'postDelete', function (\OCP\IGroup $group) { $appManager = self::$server->getAppManager(); $apps = $appManager->getEnabledAppsForGroup($group); foreach ($apps as $appId) { diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php index e4306ca0369..c600c15068d 100644 --- a/lib/composer/composer/autoload_classmap.php +++ b/lib/composer/composer/autoload_classmap.php @@ -1085,6 +1085,7 @@ return array( 'OC\\Log\\File' => $baseDir . '/lib/private/Log/File.php', 'OC\\Log\\LogDetails' => $baseDir . '/lib/private/Log/LogDetails.php', 'OC\\Log\\LogFactory' => $baseDir . '/lib/private/Log/LogFactory.php', + 'OC\\Log\\PsrLoggerAdapter' => $baseDir . '/lib/private/Log/PsrLoggerAdapter.php', 'OC\\Log\\Rotate' => $baseDir . '/lib/private/Log/Rotate.php', 'OC\\Log\\Syslog' => $baseDir . '/lib/private/Log/Syslog.php', 'OC\\Log\\Systemdlog' => $baseDir . '/lib/private/Log/Systemdlog.php', @@ -1123,6 +1124,7 @@ return array( 'OC\\Preview\\BMP' => $baseDir . '/lib/private/Preview/BMP.php', 'OC\\Preview\\BackgroundCleanupJob' => $baseDir . '/lib/private/Preview/BackgroundCleanupJob.php', 'OC\\Preview\\Bitmap' => $baseDir . '/lib/private/Preview/Bitmap.php', + 'OC\\Preview\\Bundled' => $baseDir . '/lib/private/Preview/Bundled.php', 'OC\\Preview\\Font' => $baseDir . '/lib/private/Preview/Font.php', 'OC\\Preview\\GIF' => $baseDir . '/lib/private/Preview/GIF.php', 'OC\\Preview\\Generator' => $baseDir . '/lib/private/Preview/Generator.php', @@ -1131,6 +1133,7 @@ return array( 'OC\\Preview\\Illustrator' => $baseDir . '/lib/private/Preview/Illustrator.php', 'OC\\Preview\\Image' => $baseDir . '/lib/private/Preview/Image.php', 'OC\\Preview\\JPEG' => $baseDir . '/lib/private/Preview/JPEG.php', + 'OC\\Preview\\Krita' => $baseDir . '/lib/private/Preview/Krita.php', 'OC\\Preview\\MP3' => $baseDir . '/lib/private/Preview/MP3.php', 'OC\\Preview\\MSOffice2003' => $baseDir . '/lib/private/Preview/MSOffice2003.php', 'OC\\Preview\\MSOffice2007' => $baseDir . '/lib/private/Preview/MSOffice2007.php', diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php index abc4a40fd75..87a9460f77b 100644 --- a/lib/composer/composer/autoload_static.php +++ b/lib/composer/composer/autoload_static.php @@ -1114,6 +1114,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OC\\Log\\File' => __DIR__ . '/../../..' . '/lib/private/Log/File.php', 'OC\\Log\\LogDetails' => __DIR__ . '/../../..' . '/lib/private/Log/LogDetails.php', 'OC\\Log\\LogFactory' => __DIR__ . '/../../..' . '/lib/private/Log/LogFactory.php', + 'OC\\Log\\PsrLoggerAdapter' => __DIR__ . '/../../..' . '/lib/private/Log/PsrLoggerAdapter.php', 'OC\\Log\\Rotate' => __DIR__ . '/../../..' . '/lib/private/Log/Rotate.php', 'OC\\Log\\Syslog' => __DIR__ . '/../../..' . '/lib/private/Log/Syslog.php', 'OC\\Log\\Systemdlog' => __DIR__ . '/../../..' . '/lib/private/Log/Systemdlog.php', @@ -1152,6 +1153,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OC\\Preview\\BMP' => __DIR__ . '/../../..' . '/lib/private/Preview/BMP.php', 'OC\\Preview\\BackgroundCleanupJob' => __DIR__ . '/../../..' . '/lib/private/Preview/BackgroundCleanupJob.php', 'OC\\Preview\\Bitmap' => __DIR__ . '/../../..' . '/lib/private/Preview/Bitmap.php', + 'OC\\Preview\\Bundled' => __DIR__ . '/../../..' . '/lib/private/Preview/Bundled.php', 'OC\\Preview\\Font' => __DIR__ . '/../../..' . '/lib/private/Preview/Font.php', 'OC\\Preview\\GIF' => __DIR__ . '/../../..' . '/lib/private/Preview/GIF.php', 'OC\\Preview\\Generator' => __DIR__ . '/../../..' . '/lib/private/Preview/Generator.php', @@ -1160,6 +1162,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OC\\Preview\\Illustrator' => __DIR__ . '/../../..' . '/lib/private/Preview/Illustrator.php', 'OC\\Preview\\Image' => __DIR__ . '/../../..' . '/lib/private/Preview/Image.php', 'OC\\Preview\\JPEG' => __DIR__ . '/../../..' . '/lib/private/Preview/JPEG.php', + 'OC\\Preview\\Krita' => __DIR__ . '/../../..' . '/lib/private/Preview/Krita.php', 'OC\\Preview\\MP3' => __DIR__ . '/../../..' . '/lib/private/Preview/MP3.php', 'OC\\Preview\\MSOffice2003' => __DIR__ . '/../../..' . '/lib/private/Preview/MSOffice2003.php', 'OC\\Preview\\MSOffice2007' => __DIR__ . '/../../..' . '/lib/private/Preview/MSOffice2007.php', diff --git a/lib/l10n/nl.js b/lib/l10n/nl.js index 57a848bfe77..630642a52d4 100644 --- a/lib/l10n/nl.js +++ b/lib/l10n/nl.js @@ -5,6 +5,7 @@ OC.L10N.register( "This can usually be fixed by giving the webserver write access to the config directory" : "Dit kan opgelost worden door de config map op de webserver schrijfrechten te geven", "Or, if you prefer to keep config.php file read only, set the option \"config_is_read_only\" to true in it." : "Of, als je liever config.php alleen-lezen wilt houden, stel de optie \"config_is_read_only\" in op true.", "See %s" : "Zie %s", + "This can usually be fixed by giving the webserver write access to the config directory." : "Dit kan opgelost worden door de config map op de webserver schrijfrechten te geven.", "Or, if you prefer to keep config.php file read only, set the option \"config_is_read_only\" to true in it. See %s" : "Of, als je liever config.php Alleen-lezen houdt, stel de optie \"config_is_read_only\" in op true. Zie %s", "The files of the app %1$s were not replaced correctly. Make sure it is a version compatible with the server." : "De bestanden van app %1$szijn niet correct vervangen. Zorg ervoor dat de versie compatible is met de server.", "Sample configuration detected" : "Voorbeeld configuratie gevonden", @@ -186,6 +187,7 @@ OC.L10N.register( "Cannot write into \"config\" directory" : "Kan niet schrijven naar de \"config\" directory", "This can usually be fixed by giving the webserver write access to the config directory. See %s" : "Dit kan opgelost worden door de config map op de webserver schrijf rechten te geven. See %s", "Cannot write into \"apps\" directory" : "Kan niet schrijven naar de \"apps\" directory", + "This can usually be fixed by giving the webserver write access to the apps directory or disabling the appstore in the config file." : "Dit kan hersteld worden door de webserver schrijfrechten te geven op de appsdirectory of door de appstore te deactiveren in het configuratie bestand.", "Cannot create \"data\" directory" : "\"data\" map kan niet worden aangemaakt", "This can usually be fixed by giving the webserver write access to the root directory. See %s" : "Dit kan hersteld worden door de root map schrijf rechten te geven op de webserver. Zie %s", "Permissions can usually be fixed by giving the webserver write access to the root directory. See %s." : "Rechten kunnen worden hersteld door de root map op de webserver schrijf toegang te geven. Zie %s.", diff --git a/lib/l10n/nl.json b/lib/l10n/nl.json index 0b66deefc33..0d613dad17f 100644 --- a/lib/l10n/nl.json +++ b/lib/l10n/nl.json @@ -3,6 +3,7 @@ "This can usually be fixed by giving the webserver write access to the config directory" : "Dit kan opgelost worden door de config map op de webserver schrijfrechten te geven", "Or, if you prefer to keep config.php file read only, set the option \"config_is_read_only\" to true in it." : "Of, als je liever config.php alleen-lezen wilt houden, stel de optie \"config_is_read_only\" in op true.", "See %s" : "Zie %s", + "This can usually be fixed by giving the webserver write access to the config directory." : "Dit kan opgelost worden door de config map op de webserver schrijfrechten te geven.", "Or, if you prefer to keep config.php file read only, set the option \"config_is_read_only\" to true in it. See %s" : "Of, als je liever config.php Alleen-lezen houdt, stel de optie \"config_is_read_only\" in op true. Zie %s", "The files of the app %1$s were not replaced correctly. Make sure it is a version compatible with the server." : "De bestanden van app %1$szijn niet correct vervangen. Zorg ervoor dat de versie compatible is met de server.", "Sample configuration detected" : "Voorbeeld configuratie gevonden", @@ -184,6 +185,7 @@ "Cannot write into \"config\" directory" : "Kan niet schrijven naar de \"config\" directory", "This can usually be fixed by giving the webserver write access to the config directory. See %s" : "Dit kan opgelost worden door de config map op de webserver schrijf rechten te geven. See %s", "Cannot write into \"apps\" directory" : "Kan niet schrijven naar de \"apps\" directory", + "This can usually be fixed by giving the webserver write access to the apps directory or disabling the appstore in the config file." : "Dit kan hersteld worden door de webserver schrijfrechten te geven op de appsdirectory of door de appstore te deactiveren in het configuratie bestand.", "Cannot create \"data\" directory" : "\"data\" map kan niet worden aangemaakt", "This can usually be fixed by giving the webserver write access to the root directory. See %s" : "Dit kan hersteld worden door de root map schrijf rechten te geven op de webserver. Zie %s", "Permissions can usually be fixed by giving the webserver write access to the root directory. See %s." : "Rechten kunnen worden hersteld door de root map op de webserver schrijf toegang te geven. Zie %s.", diff --git a/lib/l10n/tr.js b/lib/l10n/tr.js index e9a050a0dc7..1746909dad7 100644 --- a/lib/l10n/tr.js +++ b/lib/l10n/tr.js @@ -5,6 +5,7 @@ OC.L10N.register( "This can usually be fixed by giving the webserver write access to the config directory" : "Bu sorun genellikle, web sunucusuna config klasörüne yazma izni verilerek çözülebilir", "Or, if you prefer to keep config.php file read only, set the option \"config_is_read_only\" to true in it." : "Ya da config.php dosyasının salt okunur olarak kalmasını istiyorsanız içindeki \"config_is_read_only\" seçeneğini true olarak ayarlayın.", "See %s" : "Şuraya bakın: %s", + "This can usually be fixed by giving the webserver write access to the config directory." : "Bu sorun genellikle, web sunucusuna config klasörüne yazma izni verilerek çözülebilir.", "Or, if you prefer to keep config.php file read only, set the option \"config_is_read_only\" to true in it. See %s" : "Ya da config.php dosyasının salt okunur olarak kalmasını istiyorsanız içindeki \"config_is_read_only\" seçeneğini true olarak ayarlayın. %s bölümüne bakabilirsiniz", "The files of the app %1$s were not replaced correctly. Make sure it is a version compatible with the server." : "%1$s uygulamasının dosyaları doğru şekilde değiştirilmedi. Sunucu ile uyumlu dosyaların yüklü olduğundan emin olun.", "Sample configuration detected" : "Örnek yapılandırma algılandı", @@ -186,6 +187,7 @@ OC.L10N.register( "Cannot write into \"config\" directory" : "\"config\" klasörüne yazılamıyor", "This can usually be fixed by giving the webserver write access to the config directory. See %s" : "Bu sorun genellikle, web sunucusuna config klasörüne yazma izni verilerek çözülebilir. %s bölümüne bakın", "Cannot write into \"apps\" directory" : "\"apps\" klasörüne yazılamıyor", + "This can usually be fixed by giving the webserver write access to the apps directory or disabling the appstore in the config file." : "Bu sorun genellikle, web sunucusuna apps klasörüne yazma izni verilerek ya da yapılandırma dosyasından uygulama mağazasını devre dışı bırakılarak çözülebilir.", "Cannot create \"data\" directory" : "\"data\" klasörü oluşturulamadı", "This can usually be fixed by giving the webserver write access to the root directory. See %s" : "Bu sorun genellikle, web sunucusuna kök klasöre yazma izni verilerek çözülebilir. %s bölümüne bakın", "Permissions can usually be fixed by giving the webserver write access to the root directory. See %s." : "İzinler genellikle, web sunucusuna kök klasöre yazma izni verilerek düzeltilebilir. %s bölümüne bakın.", diff --git a/lib/l10n/tr.json b/lib/l10n/tr.json index 6f90a7f5591..d39d456185d 100644 --- a/lib/l10n/tr.json +++ b/lib/l10n/tr.json @@ -3,6 +3,7 @@ "This can usually be fixed by giving the webserver write access to the config directory" : "Bu sorun genellikle, web sunucusuna config klasörüne yazma izni verilerek çözülebilir", "Or, if you prefer to keep config.php file read only, set the option \"config_is_read_only\" to true in it." : "Ya da config.php dosyasının salt okunur olarak kalmasını istiyorsanız içindeki \"config_is_read_only\" seçeneğini true olarak ayarlayın.", "See %s" : "Şuraya bakın: %s", + "This can usually be fixed by giving the webserver write access to the config directory." : "Bu sorun genellikle, web sunucusuna config klasörüne yazma izni verilerek çözülebilir.", "Or, if you prefer to keep config.php file read only, set the option \"config_is_read_only\" to true in it. See %s" : "Ya da config.php dosyasının salt okunur olarak kalmasını istiyorsanız içindeki \"config_is_read_only\" seçeneğini true olarak ayarlayın. %s bölümüne bakabilirsiniz", "The files of the app %1$s were not replaced correctly. Make sure it is a version compatible with the server." : "%1$s uygulamasının dosyaları doğru şekilde değiştirilmedi. Sunucu ile uyumlu dosyaların yüklü olduğundan emin olun.", "Sample configuration detected" : "Örnek yapılandırma algılandı", @@ -184,6 +185,7 @@ "Cannot write into \"config\" directory" : "\"config\" klasörüne yazılamıyor", "This can usually be fixed by giving the webserver write access to the config directory. See %s" : "Bu sorun genellikle, web sunucusuna config klasörüne yazma izni verilerek çözülebilir. %s bölümüne bakın", "Cannot write into \"apps\" directory" : "\"apps\" klasörüne yazılamıyor", + "This can usually be fixed by giving the webserver write access to the apps directory or disabling the appstore in the config file." : "Bu sorun genellikle, web sunucusuna apps klasörüne yazma izni verilerek ya da yapılandırma dosyasından uygulama mağazasını devre dışı bırakılarak çözülebilir.", "Cannot create \"data\" directory" : "\"data\" klasörü oluşturulamadı", "This can usually be fixed by giving the webserver write access to the root directory. See %s" : "Bu sorun genellikle, web sunucusuna kök klasöre yazma izni verilerek çözülebilir. %s bölümüne bakın", "Permissions can usually be fixed by giving the webserver write access to the root directory. See %s." : "İzinler genellikle, web sunucusuna kök klasöre yazma izni verilerek düzeltilebilir. %s bölümüne bakın.", diff --git a/lib/private/Accounts/Account.php b/lib/private/Accounts/Account.php index 3702458ec6b..446bb01d860 100644 --- a/lib/private/Accounts/Account.php +++ b/lib/private/Accounts/Account.php @@ -60,7 +60,7 @@ class Account implements IAccount { } public function getFilteredProperties(string $scope = null, string $verified = null): array { - return \array_filter($this->properties, function(IAccountProperty $obj) use ($scope, $verified){ + return \array_filter($this->properties, function (IAccountProperty $obj) use ($scope, $verified) { if ($scope !== null && $scope !== $obj->getScope()) { return false; } diff --git a/lib/private/Activity/Event.php b/lib/private/Activity/Event.php index dcd854b9fe0..85f896622b9 100644 --- a/lib/private/Activity/Event.php +++ b/lib/private/Activity/Event.php @@ -524,10 +524,10 @@ class Event implements IEvent { $this->getTimestamp() !== 0 /** * Disabled for BC with old activities - && - $this->getObjectType() !== '' - && - $this->getObjectId() !== 0 + * && + * $this->getObjectType() !== '' + * && + * $this->getObjectId() !== 0 */ ; } diff --git a/lib/private/Activity/Manager.php b/lib/private/Activity/Manager.php index c1b09300033..fc1c32a475f 100644 --- a/lib/private/Activity/Manager.php +++ b/lib/private/Activity/Manager.php @@ -28,7 +28,6 @@ namespace OC\Activity; - use OCP\Activity\IConsumer; use OCP\Activity\IEvent; use OCP\Activity\IFilter; diff --git a/lib/private/AllConfig.php b/lib/private/AllConfig.php index a41230e4a97..e62b000938b 100644 --- a/lib/private/AllConfig.php +++ b/lib/private/AllConfig.php @@ -31,6 +31,7 @@ */ namespace OC; + use OC\Cache\CappedMemoryCache; use OCP\IDBConnection; use OCP\PreConditionNotMetException; diff --git a/lib/private/App/CodeChecker/CodeChecker.php b/lib/private/App/CodeChecker/CodeChecker.php index 53fee7482ef..60276d5bfcc 100644 --- a/lib/private/App/CodeChecker/CodeChecker.php +++ b/lib/private/App/CodeChecker/CodeChecker.php @@ -89,12 +89,12 @@ class CodeChecker extends BasicEmitter { $excludedDirectories[] = 'lists'; } - $excludes = array_map(function($item) use ($folder) { + $excludes = array_map(function ($item) use ($folder) { return $folder . '/' . $item; }, $excludedDirectories); $iterator = new RecursiveDirectoryIterator($folder, RecursiveDirectoryIterator::SKIP_DOTS); - $iterator = new RecursiveCallbackFilterIterator($iterator, function($item) use ($excludes){ + $iterator = new RecursiveCallbackFilterIterator($iterator, function ($item) use ($excludes) { /** @var SplFileInfo $item */ foreach($excludes as $exclude) { if (substr($item->getPath(), 0, strlen($exclude)) === $exclude) { diff --git a/lib/private/AppConfig.php b/lib/private/AppConfig.php index e562870aa7f..f922033bdd1 100644 --- a/lib/private/AppConfig.php +++ b/lib/private/AppConfig.php @@ -284,7 +284,7 @@ class AppConfig implements IAppConfig { return $this->getAppValues($app); } else { $appIds = $this->getApps(); - $values = array_map(function($appId) use ($key) { + $values = array_map(function ($appId) use ($key) { return isset($this->cache[$appId][$key]) ? $this->cache[$appId][$key] : null; }, $appIds); $result = array_combine($appIds, $values); diff --git a/lib/private/AppFramework/App.php b/lib/private/AppFramework/App.php index 2cbe623bb27..f7defda487e 100644 --- a/lib/private/AppFramework/App.php +++ b/lib/private/AppFramework/App.php @@ -199,7 +199,7 @@ class App { * @param DIContainer $container an instance of a pimple container. */ public static function part(string $controllerName, string $methodName, array $urlParams, - DIContainer $container){ + DIContainer $container) { $container['urlParams'] = $urlParams; $controller = $container[$controllerName]; diff --git a/lib/private/AppFramework/DependencyInjection/DIContainer.php b/lib/private/AppFramework/DependencyInjection/DIContainer.php index 6f4a48d8907..14898fadf95 100644 --- a/lib/private/AppFramework/DependencyInjection/DIContainer.php +++ b/lib/private/AppFramework/DependencyInjection/DIContainer.php @@ -83,7 +83,7 @@ class DIContainer extends SimpleContainer implements IAppContainer { * @param array $urlParams * @param ServerContainer|null $server */ - public function __construct($appName, $urlParams = [], ServerContainer $server = null){ + public function __construct($appName, $urlParams = [], ServerContainer $server = null) { parent::__construct(); $this['AppName'] = $appName; $this['urlParams'] = $urlParams; @@ -105,11 +105,11 @@ class DIContainer extends SimpleContainer implements IAppContainer { /** * Core services */ - $this->registerService(IOutput::class, function(){ + $this->registerService(IOutput::class, function () { return new Output($this->getServer()->getWebRoot()); }); - $this->registerService(Folder::class, function() { + $this->registerService(Folder::class, function () { return $this->getServer()->getUserFolder(); }); @@ -117,7 +117,7 @@ class DIContainer extends SimpleContainer implements IAppContainer { return $this->getServer()->getAppDataDir($c->query('AppName')); }); - $this->registerService(IL10N::class, function($c) { + $this->registerService(IL10N::class, function ($c) { return $this->getServer()->getL10N($c->query('AppName')); }); @@ -156,14 +156,14 @@ class DIContainer extends SimpleContainer implements IAppContainer { return $c->query(OC\GlobalScale\Config::class); }); - $this->registerService('Protocol', function($c){ + $this->registerService('Protocol', function ($c) { /** @var \OC\Server $server */ $server = $c->query('ServerContainer'); $protocol = $server->getRequest()->getHttpProtocol(); return new Http($_SERVER, $protocol); }); - $this->registerService('Dispatcher', function($c) { + $this->registerService('Dispatcher', function ($c) { return new Dispatcher( $c['Protocol'], $c['MiddlewareDispatcher'], @@ -182,7 +182,7 @@ class DIContainer extends SimpleContainer implements IAppContainer { /** * Middleware */ - $this->registerService('MiddlewareDispatcher', function(SimpleContainer $c) { + $this->registerService('MiddlewareDispatcher', function (SimpleContainer $c) { $server = $this->getServer(); $dispatcher = new MiddlewareDispatcher(); @@ -376,7 +376,7 @@ class DIContainer extends SimpleContainer implements IAppContainer { * @param string $serviceName e.g. 'OCA\Files\Capabilities' */ public function registerCapability($serviceName) { - $this->query('OC\CapabilitiesManager')->registerCapability(function() use ($serviceName) { + $this->query('OC\CapabilitiesManager')->registerCapability(function () use ($serviceName) { return $this->query($serviceName); }); } diff --git a/lib/private/AppFramework/Http.php b/lib/private/AppFramework/Http.php index 56503ce9595..4b08812b6cf 100644 --- a/lib/private/AppFramework/Http.php +++ b/lib/private/AppFramework/Http.php @@ -117,8 +117,8 @@ class Http extends BaseHttp { * @param string $ETag the etag * @return string */ - public function getStatusHeader($status, \DateTime $lastModified=null, - $ETag=null) { + public function getStatusHeader($status, \DateTime $lastModified=null, + $ETag=null) { if(!is_null($lastModified)) { $lastModified = $lastModified->format(\DateTime::RFC2822); @@ -131,7 +131,7 @@ class Http extends BaseHttp { || (isset($this->server['HTTP_IF_MODIFIED_SINCE']) - && trim($this->server['HTTP_IF_MODIFIED_SINCE']) === + && trim($this->server['HTTP_IF_MODIFIED_SINCE']) === $lastModified)) { $status = self::STATUS_NOT_MODIFIED; @@ -140,13 +140,13 @@ class Http extends BaseHttp { // we have one change currently for the http 1.0 header that differs // from 1.1: STATUS_TEMPORARY_REDIRECT should be STATUS_FOUND // if this differs any more, we want to create childclasses for this - if($status === self::STATUS_TEMPORARY_REDIRECT + if($status === self::STATUS_TEMPORARY_REDIRECT && $this->protocolVersion === 'HTTP/1.0') { $status = self::STATUS_FOUND; } - return $this->protocolVersion . ' ' . $status . ' ' . + return $this->protocolVersion . ' ' . $status . ' ' . $this->headers[$status]; } diff --git a/lib/private/AppFramework/Http/Request.php b/lib/private/AppFramework/Http/Request.php index 6554250902d..9b8c0690ba6 100644 --- a/lib/private/AppFramework/Http/Request.php +++ b/lib/private/AppFramework/Http/Request.php @@ -187,25 +187,25 @@ class Request implements \ArrayAccess, \Countable, IRequest { } /** - * ArrayAccess methods - * - * Gives access to the combined GET, POST and urlParams arrays - * - * Examples: - * - * $var = $request['myvar']; - * - * or - * - * if(!isset($request['myvar']) { - * // Do something - * } - * - * $request['myvar'] = 'something'; // This throws an exception. - * - * @param string $offset The key to lookup - * @return boolean - */ + * ArrayAccess methods + * + * Gives access to the combined GET, POST and urlParams arrays + * + * Examples: + * + * $var = $request['myvar']; + * + * or + * + * if(!isset($request['myvar']) { + * // Do something + * } + * + * $request['myvar'] = 'something'; // This throws an exception. + * + * @param string $offset The key to lookup + * @return boolean + */ public function offsetExists($offset): bool { return isset($this->items['parameters'][$offset]); } @@ -248,20 +248,20 @@ class Request implements \ArrayAccess, \Countable, IRequest { } /** - * Access request variables by method and name. - * Examples: - * - * $request->post['myvar']; // Only look for POST variables - * $request->myvar; or $request->{'myvar'}; or $request->{$myvar} - * Looks in the combined GET, POST and urlParams array. - * - * If you access e.g. ->post but the current HTTP request method - * is GET a \LogicException will be thrown. - * - * @param string $name The key to look for. - * @throws \LogicException - * @return mixed|null - */ + * Access request variables by method and name. + * Examples: + * + * $request->post['myvar']; // Only look for POST variables + * $request->myvar; or $request->{'myvar'}; or $request->{$myvar} + * Looks in the combined GET, POST and urlParams array. + * + * If you access e.g. ->post but the current HTTP request method + * is GET a \LogicException will be thrown. + * + * @param string $name The key to look for. + * @throws \LogicException + * @return mixed|null + */ public function __get($name) { switch($name) { case 'put': @@ -327,8 +327,8 @@ class Request implements \ArrayAccess, \Countable, IRequest { // There's a few headers that seem to end up in the top-level // server array. switch ($name) { - case 'CONTENT_TYPE' : - case 'CONTENT_LENGTH' : + case 'CONTENT_TYPE': + case 'CONTENT_LENGTH': case 'REMOTE_ADDR': if (isset($this->server[$name])) { return $this->server[$name]; @@ -811,7 +811,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { $encoding = mb_detect_encoding($pathInfo, ['UTF-8', 'ISO-8859-1']); switch($encoding) { - case 'ISO-8859-1' : + case 'ISO-8859-1': $pathInfo = utf8_encode($pathInfo); } // end copy diff --git a/lib/private/AppFramework/Middleware/MiddlewareDispatcher.php b/lib/private/AppFramework/Middleware/MiddlewareDispatcher.php index 10cb9249a51..47b9a62af81 100644 --- a/lib/private/AppFramework/Middleware/MiddlewareDispatcher.php +++ b/lib/private/AppFramework/Middleware/MiddlewareDispatcher.php @@ -55,7 +55,7 @@ class MiddlewareDispatcher { /** * Constructor */ - public function __construct(){ + public function __construct() { $this->middlewares = []; $this->middlewareCounter = 0; } @@ -65,7 +65,7 @@ class MiddlewareDispatcher { * Adds a new middleware * @param Middleware $middleWare the middleware which will be added */ - public function registerMiddleware(Middleware $middleWare){ + public function registerMiddleware(Middleware $middleWare) { $this->middlewares[] = $middleWare; } @@ -87,7 +87,7 @@ class MiddlewareDispatcher { * @param string $methodName the name of the method that will be called on * the controller */ - public function beforeController(Controller $controller, string $methodName){ + public function beforeController(Controller $controller, string $methodName) { // we need to count so that we know which middlewares we have to ask in // case there is an exception $middlewareCount = \count($this->middlewares); diff --git a/lib/private/AppFramework/Middleware/OCSMiddleware.php b/lib/private/AppFramework/Middleware/OCSMiddleware.php index d52163246c7..fe0f58c1ab5 100644 --- a/lib/private/AppFramework/Middleware/OCSMiddleware.php +++ b/lib/private/AppFramework/Middleware/OCSMiddleware.php @@ -101,7 +101,7 @@ class OCSMiddleware extends Middleware { */ if ($controller instanceof OCSController && !($response instanceof BaseResponse)) { if ($response->getStatus() === Http::STATUS_UNAUTHORIZED || - $response->getStatus() === Http::STATUS_FORBIDDEN) { + $response->getStatus() === Http::STATUS_FORBIDDEN) { $message = ''; if ($response instanceof JSONResponse) { diff --git a/lib/private/AppFramework/Middleware/Security/CORSMiddleware.php b/lib/private/AppFramework/Middleware/Security/CORSMiddleware.php index 1883756954b..acfbab25ed4 100644 --- a/lib/private/AppFramework/Middleware/Security/CORSMiddleware.php +++ b/lib/private/AppFramework/Middleware/Security/CORSMiddleware.php @@ -80,7 +80,7 @@ class CORSMiddleware extends Middleware { * @throws SecurityException * @since 6.0.0 */ - public function beforeController($controller, $methodName){ + public function beforeController($controller, $methodName) { // ensure that @CORS annotated API routes are not used in conjunction // with session authentication since this enables CSRF attack vectors if ($this->reflector->hasAnnotation('CORS') && @@ -110,7 +110,7 @@ class CORSMiddleware extends Middleware { * @return Response a Response object * @throws SecurityException */ - public function afterController($controller, $methodName, Response $response){ + public function afterController($controller, $methodName, Response $response) { // only react if its a CORS request and if the request sends origin and if(isset($this->request->server['HTTP_ORIGIN']) && @@ -143,7 +143,7 @@ class CORSMiddleware extends Middleware { * @throws \Exception the passed in exception if it can't handle it * @return Response a Response object or null in case that the exception could not be handled */ - public function afterException($controller, $methodName, \Exception $exception){ + public function afterException($controller, $methodName, \Exception $exception) { if($exception instanceof SecurityException){ $response = new JSONResponse(['message' => $exception->getMessage()]); if($exception->getCode() !== 0) { diff --git a/lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php b/lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php index 16f1fb35a82..0ae2d37b374 100644 --- a/lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php +++ b/lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php @@ -212,7 +212,7 @@ class SecurityMiddleware extends Middleware { if($exception instanceof SecurityException) { if($exception instanceof StrictCookieMissingException) { return new RedirectResponse(\OC::$WEBROOT); - } + } if (stripos($this->request->getHeader('Accept'),'html') === false) { $response = new JSONResponse( ['message' => $exception->getMessage()], diff --git a/lib/private/AppFramework/Middleware/SessionMiddleware.php b/lib/private/AppFramework/Middleware/SessionMiddleware.php index 1f4ba123104..d2787dde745 100644 --- a/lib/private/AppFramework/Middleware/SessionMiddleware.php +++ b/lib/private/AppFramework/Middleware/SessionMiddleware.php @@ -62,7 +62,7 @@ class SessionMiddleware extends Middleware { * @param Response $response * @return Response */ - public function afterController($controller, $methodName, Response $response){ + public function afterController($controller, $methodName, Response $response) { $useSession = $this->reflector->hasAnnotation('UseSession'); if ($useSession) { $this->session->close(); diff --git a/lib/private/AppFramework/Utility/ControllerMethodReflector.php b/lib/private/AppFramework/Utility/ControllerMethodReflector.php index ac7953e0457..31f1892772f 100644 --- a/lib/private/AppFramework/Utility/ControllerMethodReflector.php +++ b/lib/private/AppFramework/Utility/ControllerMethodReflector.php @@ -46,7 +46,7 @@ class ControllerMethodReflector implements IControllerMethodReflector { * @param object $object an object or classname * @param string $method the method which we want to inspect */ - public function reflect($object, string $method){ + public function reflect($object, string $method) { $reflection = new \ReflectionMethod($object, $method); $docs = $reflection->getDocComment(); diff --git a/lib/private/Authentication/Events/LoginFailed.php b/lib/private/Authentication/Events/LoginFailed.php index cc5a547fdef..6e32e419871 100644 --- a/lib/private/Authentication/Events/LoginFailed.php +++ b/lib/private/Authentication/Events/LoginFailed.php @@ -1,4 +1,5 @@ <?php + declare(strict_types=1); /** * @copyright Copyright (c) 2020, Roeland Jago Douma <roeland@famdouma.nl> diff --git a/lib/private/Authentication/Listeners/LoginFailedListener.php b/lib/private/Authentication/Listeners/LoginFailedListener.php index d4f46d9547f..8086194eab3 100644 --- a/lib/private/Authentication/Listeners/LoginFailedListener.php +++ b/lib/private/Authentication/Listeners/LoginFailedListener.php @@ -1,4 +1,5 @@ <?php + declare(strict_types=1); /** * @copyright Copyright (c) 2020, Roeland Jago Douma <roeland@famdouma.nl> diff --git a/lib/private/Authentication/Login/LoggedInCheckCommand.php b/lib/private/Authentication/Login/LoggedInCheckCommand.php index 78f27bfa937..5701f2970a8 100644 --- a/lib/private/Authentication/Login/LoggedInCheckCommand.php +++ b/lib/private/Authentication/Login/LoggedInCheckCommand.php @@ -27,11 +27,9 @@ namespace OC\Authentication\Login; use OC\Authentication\Events\LoginFailed; use OC\Core\Controller\LoginController; -use OCP\Authentication\Events\LoginFailedEvent; use OCP\EventDispatcher\IEventDispatcher; use OCP\ILogger; use OCP\IUserManager; -use OCP\Util; class LoggedInCheckCommand extends ALoginCommand { diff --git a/lib/private/Authentication/Login/WebAuthnChain.php b/lib/private/Authentication/Login/WebAuthnChain.php index dfc6943e853..ff6dd23e1ef 100644 --- a/lib/private/Authentication/Login/WebAuthnChain.php +++ b/lib/private/Authentication/Login/WebAuthnChain.php @@ -1,4 +1,5 @@ <?php + declare(strict_types=1); /** * @copyright Copyright (c) 2020, Roeland Jago Douma <roeland@famdouma.nl> diff --git a/lib/private/Authentication/Login/WebAuthnLoginCommand.php b/lib/private/Authentication/Login/WebAuthnLoginCommand.php index e477a243c56..d2f613c59be 100644 --- a/lib/private/Authentication/Login/WebAuthnLoginCommand.php +++ b/lib/private/Authentication/Login/WebAuthnLoginCommand.php @@ -1,4 +1,5 @@ <?php + declare(strict_types=1); /** * @copyright Copyright (c) 2020, Roeland Jago Douma <roeland@famdouma.nl> diff --git a/lib/private/Authentication/Token/INamedToken.php b/lib/private/Authentication/Token/INamedToken.php index 99eb338e8d4..30755879963 100644 --- a/lib/private/Authentication/Token/INamedToken.php +++ b/lib/private/Authentication/Token/INamedToken.php @@ -27,7 +27,6 @@ declare(strict_types=1); namespace OC\Authentication\Token; - interface INamedToken extends IToken { /** * Set token name diff --git a/lib/private/Authentication/TwoFactorAuth/Manager.php b/lib/private/Authentication/TwoFactorAuth/Manager.php index 170048f451b..40e6e4082e1 100644 --- a/lib/private/Authentication/TwoFactorAuth/Manager.php +++ b/lib/private/Authentication/TwoFactorAuth/Manager.php @@ -140,7 +140,7 @@ class Manager { */ public function getLoginSetupProviders(IUser $user): array { $providers = $this->providerLoader->getProviders($user); - return array_filter($providers, function(IProvider $provider) { + return array_filter($providers, function (IProvider $provider) { return ($provider instanceof IActivatableAtLogin); }); } @@ -198,8 +198,8 @@ class Manager { $missing[] = $providerId; $this->logger->alert("two-factor auth provider '$providerId' failed to load", [ - 'app' => 'core', - ]); + 'app' => 'core', + ]); } } diff --git a/lib/private/Authentication/TwoFactorAuth/ProviderSet.php b/lib/private/Authentication/TwoFactorAuth/ProviderSet.php index a1577de7440..5b5ac60fd82 100644 --- a/lib/private/Authentication/TwoFactorAuth/ProviderSet.php +++ b/lib/private/Authentication/TwoFactorAuth/ProviderSet.php @@ -72,7 +72,7 @@ class ProviderSet { * @return IProvider[] */ public function getPrimaryProviders(): array { - return array_filter($this->providers, function(IProvider $provider) { + return array_filter($this->providers, function (IProvider $provider) { return !($provider instanceof BackupCodesProvider); }); } diff --git a/lib/private/Authentication/WebAuthn/CredentialRepository.php b/lib/private/Authentication/WebAuthn/CredentialRepository.php index c6f8cdfd888..c57af15d2e4 100644 --- a/lib/private/Authentication/WebAuthn/CredentialRepository.php +++ b/lib/private/Authentication/WebAuthn/CredentialRepository.php @@ -1,4 +1,5 @@ <?php + declare(strict_types=1); /** * @copyright Copyright (c) 2020, Roeland Jago Douma <roeland@famdouma.nl> diff --git a/lib/private/Authentication/WebAuthn/Db/PublicKeyCredentialEntity.php b/lib/private/Authentication/WebAuthn/Db/PublicKeyCredentialEntity.php index 3b0413aef00..0b27c78efbd 100644 --- a/lib/private/Authentication/WebAuthn/Db/PublicKeyCredentialEntity.php +++ b/lib/private/Authentication/WebAuthn/Db/PublicKeyCredentialEntity.php @@ -1,4 +1,5 @@ <?php + declare(strict_types=1); /** * @copyright Copyright (c) 2020, Roeland Jago Douma <roeland@famdouma.nl> @@ -27,7 +28,6 @@ namespace OC\Authentication\WebAuthn\Db; use JsonSerializable; use OCP\AppFramework\Db\Entity; use Webauthn\PublicKeyCredentialSource; -use Webauthn\TrustPath\TrustPathLoader; /** * @since 19.0.0 diff --git a/lib/private/Authentication/WebAuthn/Manager.php b/lib/private/Authentication/WebAuthn/Manager.php index 32a90345b5c..e33d0e48e9b 100644 --- a/lib/private/Authentication/WebAuthn/Manager.php +++ b/lib/private/Authentication/WebAuthn/Manager.php @@ -1,4 +1,5 @@ <?php + declare(strict_types=1); /** * @copyright Copyright (c) 2020, Roeland Jago Douma <roeland@famdouma.nl> @@ -49,7 +50,6 @@ use Webauthn\PublicKeyCredentialLoader; use Webauthn\PublicKeyCredentialParameters; use Webauthn\PublicKeyCredentialRequestOptions; use Webauthn\PublicKeyCredentialRpEntity; -use Webauthn\PublicKeyCredentialSource; use Webauthn\PublicKeyCredentialUserEntity; use Webauthn\TokenBinding\TokenBindingNotSupportedHandler; diff --git a/lib/private/Avatar/Avatar.php b/lib/private/Avatar/Avatar.php index a097db286f2..4badc8c43f5 100644 --- a/lib/private/Avatar/Avatar.php +++ b/lib/private/Avatar/Avatar.php @@ -300,7 +300,7 @@ abstract class Avatar implements IAvatar { $hash = strtolower($hash); // Already a md5 hash? - if( preg_match('/^([0-9a-f]{4}-?){8}$/', $hash, $matches) !== 1 ) { + if(preg_match('/^([0-9a-f]{4}-?){8}$/', $hash, $matches) !== 1) { $hash = md5($hash); } diff --git a/lib/private/BackgroundJob/QueuedJob.php b/lib/private/BackgroundJob/QueuedJob.php index a01e666eb57..08fae26630f 100644 --- a/lib/private/BackgroundJob/QueuedJob.php +++ b/lib/private/BackgroundJob/QueuedJob.php @@ -23,6 +23,7 @@ */ namespace OC\BackgroundJob; + use OCP\ILogger; /** diff --git a/lib/private/BackgroundJob/TimedJob.php b/lib/private/BackgroundJob/TimedJob.php index 755607bfb6d..0da8c4ad123 100644 --- a/lib/private/BackgroundJob/TimedJob.php +++ b/lib/private/BackgroundJob/TimedJob.php @@ -23,6 +23,7 @@ */ namespace OC\BackgroundJob; + use OCP\ILogger; /** diff --git a/lib/private/CapabilitiesManager.php b/lib/private/CapabilitiesManager.php index d49c55bb80d..8034b90567f 100644 --- a/lib/private/CapabilitiesManager.php +++ b/lib/private/CapabilitiesManager.php @@ -48,7 +48,7 @@ class CapabilitiesManager { /** * Get an array of al the capabilities that are registered at this manager - * + * * @param bool $public get public capabilities only * @throws \InvalidArgumentException * @return array diff --git a/lib/private/Collaboration/Collaborators/LookupPlugin.php b/lib/private/Collaboration/Collaborators/LookupPlugin.php index 79204043bd0..493c35a46d4 100644 --- a/lib/private/Collaboration/Collaborators/LookupPlugin.php +++ b/lib/private/Collaboration/Collaborators/LookupPlugin.php @@ -26,7 +26,6 @@ namespace OC\Collaboration\Collaborators; - use OCP\Collaboration\Collaborators\ISearchPlugin; use OCP\Collaboration\Collaborators\ISearchResult; use OCP\Collaboration\Collaborators\SearchResultType; diff --git a/lib/private/Collaboration/Collaborators/MailPlugin.php b/lib/private/Collaboration/Collaborators/MailPlugin.php index 3a3759b5794..bafc383f746 100644 --- a/lib/private/Collaboration/Collaborators/MailPlugin.php +++ b/lib/private/Collaboration/Collaborators/MailPlugin.php @@ -26,7 +26,6 @@ namespace OC\Collaboration\Collaborators; - use OCP\Collaboration\Collaborators\ISearchPlugin; use OCP\Collaboration\Collaborators\ISearchResult; use OCP\Collaboration\Collaborators\SearchResultType; diff --git a/lib/private/Collaboration/Collaborators/RemoteGroupPlugin.php b/lib/private/Collaboration/Collaborators/RemoteGroupPlugin.php index 2f024119c26..a922befec76 100644 --- a/lib/private/Collaboration/Collaborators/RemoteGroupPlugin.php +++ b/lib/private/Collaboration/Collaborators/RemoteGroupPlugin.php @@ -24,7 +24,6 @@ namespace OC\Collaboration\Collaborators; - use OCP\Collaboration\Collaborators\ISearchPlugin; use OCP\Collaboration\Collaborators\ISearchResult; use OCP\Collaboration\Collaborators\SearchResultType; diff --git a/lib/private/Collaboration/Collaborators/RemotePlugin.php b/lib/private/Collaboration/Collaborators/RemotePlugin.php index 5173e889b9c..6309b8e6eab 100644 --- a/lib/private/Collaboration/Collaborators/RemotePlugin.php +++ b/lib/private/Collaboration/Collaborators/RemotePlugin.php @@ -26,7 +26,6 @@ namespace OC\Collaboration\Collaborators; - use OCP\Collaboration\Collaborators\ISearchPlugin; use OCP\Collaboration\Collaborators\ISearchResult; use OCP\Collaboration\Collaborators\SearchResultType; @@ -97,7 +96,7 @@ class RemotePlugin implements ISearchPlugin { /** * Add local share if remote cloud id matches a local user ones */ - if ($localUser !== null && $remoteUser !== $this->userId && $cloudId === $localUser->getCloudId() ) { + if ($localUser !== null && $remoteUser !== $this->userId && $cloudId === $localUser->getCloudId()) { $result['wide'][] = [ 'label' => $contact['FN'], 'uuid' => $contact['UID'], diff --git a/lib/private/Collaboration/Collaborators/Search.php b/lib/private/Collaboration/Collaborators/Search.php index 7f5c5a1a811..9b9decfecbe 100644 --- a/lib/private/Collaboration/Collaborators/Search.php +++ b/lib/private/Collaboration/Collaborators/Search.php @@ -85,6 +85,13 @@ class Search implements ISearch { $searchResult->unsetResult($emailType); } + // if we have an exact local user match, there is no need to show the remote and email matches + $userType = new SearchResultType('users'); + if($searchResult->hasExactIdMatch($userType)) { + $searchResult->unsetResult($remoteType); + $searchResult->unsetResult($emailType); + } + return [$searchResult->asArray(), (bool)$hasMoreResults]; } diff --git a/lib/private/Collaboration/Collaborators/SearchResult.php b/lib/private/Collaboration/Collaborators/SearchResult.php index 768089c909a..1ee37e65589 100644 --- a/lib/private/Collaboration/Collaborators/SearchResult.php +++ b/lib/private/Collaboration/Collaborators/SearchResult.php @@ -24,7 +24,6 @@ namespace OC\Collaboration\Collaborators; - use OCP\Collaboration\Collaborators\ISearchResult; use OCP\Collaboration\Collaborators\SearchResultType; diff --git a/lib/private/Collaboration/Collaborators/UserPlugin.php b/lib/private/Collaboration/Collaborators/UserPlugin.php index bf2c1cfeda9..53dd0c66c7f 100644 --- a/lib/private/Collaboration/Collaborators/UserPlugin.php +++ b/lib/private/Collaboration/Collaborators/UserPlugin.php @@ -27,11 +27,11 @@ namespace OC\Collaboration\Collaborators; - use OCP\Collaboration\Collaborators\ISearchPlugin; use OCP\Collaboration\Collaborators\ISearchResult; use OCP\Collaboration\Collaborators\SearchResultType; use OCP\IConfig; +use OCP\IGroup; use OCP\IGroupManager; use OCP\IUser; use OCP\IUserManager; @@ -75,11 +75,11 @@ class UserPlugin implements ISearchPlugin { $userGroups = []; if ($this->shareWithGroupOnly) { // Search in all the groups this user is part of - $userGroups = $this->groupManager->getUserGroupIds($this->userSession->getUser()); + $userGroups = $this->groupManager->getUserGroups($this->userSession->getUser()); foreach ($userGroups as $userGroup) { - $usersTmp = $this->groupManager->displayNamesInGroup($userGroup, $search, $limit, $offset); - foreach ($usersTmp as $uid => $userDisplayName) { - $users[(string) $uid] = $userDisplayName; + $usersInGroup = $userGroup->searchDisplayName($search, $limit, $offset); + foreach ($usersInGroup as $user) { + $users[$user->getUID()] = $user; } } } else { @@ -88,7 +88,7 @@ class UserPlugin implements ISearchPlugin { $currentUserGroups = $this->groupManager->getUserGroupIds($this->userSession->getUser()); foreach ($usersTmp as $user) { if ($user->isEnabled()) { // Don't keep deactivated users - $users[(string) $user->getUID()] = $user->getDisplayName(); + $users[$user->getUID()] = $user; $addToWideResults = false; if ($this->shareeEnumeration && !$this->shareeEnumerationInGroupOnly) { @@ -123,9 +123,15 @@ class UserPlugin implements ISearchPlugin { $foundUserById = false; $lowerSearch = strtolower($search); - foreach ($users as $uid => $userDisplayName) { + foreach ($users as $uid => $user) { + $userDisplayName = $user->getDisplayName(); + $userEmail = $user->getEMailAddress(); $uid = (string) $uid; - if (strtolower($uid) === $lowerSearch || strtolower($userDisplayName) === $lowerSearch) { + if ( + strtolower($uid) === $lowerSearch || + strtolower($userDisplayName) === $lowerSearch || + strtolower($userEmail) === $lowerSearch + ) { if (strtolower($uid) === $lowerSearch) { $foundUserById = true; } @@ -156,7 +162,10 @@ class UserPlugin implements ISearchPlugin { if ($this->shareWithGroupOnly) { // Only add, if we have a common group - $commonGroups = array_intersect($userGroups, $this->groupManager->getUserGroupIds($user)); + $userGroupIds = array_map(function (IGroup $group) { + return $group->getGID(); + }, $userGroups); + $commonGroups = array_intersect($userGroupIds, $this->groupManager->getUserGroupIds($user)); $addUser = !empty($commonGroups); } @@ -179,6 +188,9 @@ class UserPlugin implements ISearchPlugin { $type = new SearchResultType('users'); $searchResult->addResultSet($type, $result['wide'], $result['exact']); + if (count($result['exact'])) { + $searchResult->markExactIdMatch($type); + } return $hasMoreResults; } diff --git a/lib/private/Collaboration/Resources/Collection.php b/lib/private/Collaboration/Resources/Collection.php index b890e52f33a..827f4e6dd1f 100644 --- a/lib/private/Collaboration/Resources/Collection.php +++ b/lib/private/Collaboration/Resources/Collection.php @@ -27,7 +27,6 @@ declare(strict_types=1); namespace OC\Collaboration\Resources; - use Doctrine\DBAL\Exception\ConstraintViolationException; use OCP\Collaboration\Resources\ICollection; use OCP\Collaboration\Resources\IManager; @@ -127,7 +126,7 @@ class Collection implements ICollection { * @since 16.0.0 */ public function addResource(IResource $resource): void { - array_map(function(IResource $r) use ($resource) { + array_map(function (IResource $r) use ($resource) { if ($this->isSameResource($r, $resource)) { throw new ResourceException('Already part of the collection'); } @@ -159,7 +158,7 @@ class Collection implements ICollection { * @since 16.0.0 */ public function removeResource(IResource $resource): void { - $this->resources = array_filter($this->getResources(), function(IResource $r) use ($resource) { + $this->resources = array_filter($this->getResources(), function (IResource $r) use ($resource) { return !$this->isSameResource($r, $resource); }); diff --git a/lib/private/Collaboration/Resources/Listener.php b/lib/private/Collaboration/Resources/Listener.php index 41a24960a66..608f72ebd5d 100644 --- a/lib/private/Collaboration/Resources/Listener.php +++ b/lib/private/Collaboration/Resources/Listener.php @@ -27,7 +27,6 @@ declare(strict_types=1); namespace OC\Collaboration\Resources; - use OCP\Collaboration\Resources\IManager; use OCP\IGroup; use OCP\IUser; @@ -37,7 +36,7 @@ use Symfony\Component\EventDispatcher\GenericEvent; class Listener { public static function register(EventDispatcherInterface $dispatcher): void { - $listener = function(GenericEvent $event) { + $listener = function (GenericEvent $event) { /** @var IUser $user */ $user = $event->getArgument('user'); /** @var IManager $resourceManager */ @@ -48,7 +47,7 @@ class Listener { $dispatcher->addListener(IGroup::class . '::postAddUser', $listener); $dispatcher->addListener(IGroup::class . '::postRemoveUser', $listener); - $dispatcher->addListener(IUser::class . '::postDelete', function(GenericEvent $event) { + $dispatcher->addListener(IUser::class . '::postDelete', function (GenericEvent $event) { /** @var IUser $user */ $user = $event->getSubject(); /** @var IManager $resourceManager */ @@ -57,7 +56,7 @@ class Listener { $resourceManager->invalidateAccessCacheForUser($user); }); - $dispatcher->addListener(IGroup::class . '::preDelete', function(GenericEvent $event) { + $dispatcher->addListener(IGroup::class . '::preDelete', function (GenericEvent $event) { /** @var IGroup $group */ $group = $event->getSubject(); /** @var IManager $resourceManager */ diff --git a/lib/private/Collaboration/Resources/Manager.php b/lib/private/Collaboration/Resources/Manager.php index 35ae0330e51..98cc25916fe 100644 --- a/lib/private/Collaboration/Resources/Manager.php +++ b/lib/private/Collaboration/Resources/Manager.php @@ -28,7 +28,6 @@ declare(strict_types=1); namespace OC\Collaboration\Resources; - use Doctrine\DBAL\Exception\UniqueConstraintViolationException; use OCP\Collaboration\Resources\CollectionException; use OCP\Collaboration\Resources\ICollection; diff --git a/lib/private/Collaboration/Resources/Resource.php b/lib/private/Collaboration/Resources/Resource.php index 19d7f3c0831..702bc2faf46 100644 --- a/lib/private/Collaboration/Resources/Resource.php +++ b/lib/private/Collaboration/Resources/Resource.php @@ -27,7 +27,6 @@ declare(strict_types=1); namespace OC\Collaboration\Resources; - use OCP\Collaboration\Resources\ICollection; use OCP\Collaboration\Resources\IManager; use OCP\Collaboration\Resources\IResource; diff --git a/lib/private/Color.php b/lib/private/Color.php index 11f2c4ada46..6238831c41b 100644 --- a/lib/private/Color.php +++ b/lib/private/Color.php @@ -24,7 +24,9 @@ namespace OC; class Color { - public $r, $g, $b; + public $r; + public $g; + public $b; public function __construct($r, $g, $b) { $this->r = $r; $this->g = $g; diff --git a/lib/private/Command/FileAccess.php b/lib/private/Command/FileAccess.php index 1a2e52c457b..edad7882ef9 100644 --- a/lib/private/Command/FileAccess.php +++ b/lib/private/Command/FileAccess.php @@ -25,7 +25,7 @@ namespace OC\Command; use OCP\IUser; trait FileAccess { - protected function setupFS(IUser $user){ + protected function setupFS(IUser $user) { \OC_Util::setupFS($user->getUID()); } diff --git a/lib/private/Comments/Comment.php b/lib/private/Comments/Comment.php index 3b4a523b884..a45b1e05cfe 100644 --- a/lib/private/Comments/Comment.php +++ b/lib/private/Comments/Comment.php @@ -300,8 +300,8 @@ class Comment implements IComment { */ public function setActor($actorType, $actorId) { if( - !is_string($actorType) || !trim($actorType) - || !is_string($actorId) || $actorId === '' + !is_string($actorType) || !trim($actorType) + || !is_string($actorId) || $actorId === '' ) { throw new \InvalidArgumentException('String expected.'); } @@ -386,8 +386,8 @@ class Comment implements IComment { */ public function setObject($objectType, $objectId) { if( - !is_string($objectType) || !trim($objectType) - || !is_string($objectId) || trim($objectId) === '' + !is_string($objectType) || !trim($objectType) + || !is_string($objectId) || trim($objectId) === '' ) { throw new \InvalidArgumentException('String expected.'); } diff --git a/lib/private/Config.php b/lib/private/Config.php index d2ddab5069a..0c5a9b0320d 100644 --- a/lib/private/Config.php +++ b/lib/private/Config.php @@ -239,14 +239,14 @@ class Config { $content .= var_export($this->cache, true); $content .= ";\n"; - touch ($this->configFilePath); + touch($this->configFilePath); $filePointer = fopen($this->configFilePath, 'r+'); // Prevent others not to read the config chmod($this->configFilePath, 0640); // File does not exist, this can happen when doing a fresh install - if(!is_resource ($filePointer)) { + if(!is_resource($filePointer)) { throw new HintException( "Can't write into config directory!", 'This can usually be fixed by giving the webserver write access to the config directory.'); @@ -258,7 +258,7 @@ class Config { } // Write the config and release the lock - ftruncate ($filePointer, 0); + ftruncate($filePointer, 0); fwrite($filePointer, $content); fflush($filePointer); flock($filePointer, LOCK_UN); diff --git a/lib/private/Console/TimestampFormatter.php b/lib/private/Console/TimestampFormatter.php index 946b864ac62..72e3e392e0b 100644 --- a/lib/private/Console/TimestampFormatter.php +++ b/lib/private/Console/TimestampFormatter.php @@ -23,7 +23,6 @@ namespace OC\Console; - use OCP\IConfig; use Symfony\Component\Console\Formatter\OutputFormatterInterface; use Symfony\Component\Console\Formatter\OutputFormatterStyleInterface; diff --git a/lib/private/Contacts/ContactsMenu/ActionProviderStore.php b/lib/private/Contacts/ContactsMenu/ActionProviderStore.php index c737e1ef289..b8ddf9258fa 100644 --- a/lib/private/Contacts/ContactsMenu/ActionProviderStore.php +++ b/lib/private/Contacts/ContactsMenu/ActionProviderStore.php @@ -94,7 +94,7 @@ class ActionProviderStore { * @return string[] */ private function getAppProviderClasses(IUser $user) { - return array_reduce($this->appManager->getEnabledAppsForUser($user), function($all, $appId) { + return array_reduce($this->appManager->getEnabledAppsForUser($user), function ($all, $appId) { $info = $this->appManager->getAppInfo($appId); if (!isset($info['contactsmenu']) || !isset($info['contactsmenu'])) { @@ -102,7 +102,7 @@ class ActionProviderStore { return $all; } - $providers = array_reduce($info['contactsmenu'], function($all, $provider) { + $providers = array_reduce($info['contactsmenu'], function ($all, $provider) { return array_merge($all, [$provider]); }, []); diff --git a/lib/private/Contacts/ContactsMenu/ContactsStore.php b/lib/private/Contacts/ContactsMenu/ContactsStore.php index 8199db952af..dfa6db61607 100644 --- a/lib/private/Contacts/ContactsMenu/ContactsStore.php +++ b/lib/private/Contacts/ContactsMenu/ContactsStore.php @@ -78,7 +78,7 @@ class ContactsStore implements IContactsStore { 'EMAIL' ]); - $entries = array_map(function(array $contact) { + $entries = array_map(function (array $contact) { return $this->contactArrayToEntry($contact); }, $allContacts); return $this->filterContacts( @@ -131,7 +131,7 @@ class ContactsStore implements IContactsStore { $selfUID = $self->getUID(); - return array_values(array_filter($entries, function(IEntry $entry) use ($self, $skipLocal, $ownGroupsOnly, $selfGroups, $selfUID, $disallowEnumeration, $filter) { + return array_values(array_filter($entries, function (IEntry $entry) use ($self, $skipLocal, $ownGroupsOnly, $selfGroups, $selfUID, $disallowEnumeration, $filter) { if ($skipLocal && $entry->getProperty('isLocalSystemBook') === true) { return false; } @@ -196,7 +196,7 @@ class ContactsStore implements IContactsStore { $userId = $user->getUID(); $allContacts = $this->contactsManager->search($shareWith, $filter); - $contacts = array_filter($allContacts, function($contact) use ($userId) { + $contacts = array_filter($allContacts, function ($contact) use ($userId) { return $contact['UID'] !== $userId; }); $match = null; diff --git a/lib/private/Contacts/ContactsMenu/Entry.php b/lib/private/Contacts/ContactsMenu/Entry.php index 73ac22ad69c..c4b590e9397 100644 --- a/lib/private/Contacts/ContactsMenu/Entry.php +++ b/lib/private/Contacts/ContactsMenu/Entry.php @@ -114,7 +114,7 @@ class Entry implements IEntry { * sort the actions by priority and name */ private function sortActions() { - usort($this->actions, function(IAction $action1, IAction $action2) { + usort($this->actions, function (IAction $action1, IAction $action2) { $prio1 = $action1->getPriority(); $prio2 = $action2->getPriority(); @@ -151,7 +151,7 @@ class Entry implements IEntry { */ public function jsonSerialize() { $topAction = !empty($this->actions) ? $this->actions[0]->jsonSerialize() : null; - $otherActions = array_map(function(IAction $action) { + $otherActions = array_map(function (IAction $action) { return $action->jsonSerialize(); }, array_slice($this->actions, 1)); diff --git a/lib/private/Contacts/ContactsMenu/Manager.php b/lib/private/Contacts/ContactsMenu/Manager.php index 0ebc9648285..ba761c5ece8 100644 --- a/lib/private/Contacts/ContactsMenu/Manager.php +++ b/lib/private/Contacts/ContactsMenu/Manager.php @@ -100,7 +100,7 @@ class Manager { * @return IEntry[] */ private function sortEntries(array $entries) { - usort($entries, function(IEntry $entryA, IEntry $entryB) { + usort($entries, function (IEntry $entryA, IEntry $entryB) { return strcasecmp($entryA->getFullName(), $entryB->getFullName()); }); return $entries; diff --git a/lib/private/ContactsManager.php b/lib/private/ContactsManager.php index 2913e2b5864..6ccedca77b9 100644 --- a/lib/private/ContactsManager.php +++ b/lib/private/ContactsManager.php @@ -125,7 +125,7 @@ namespace OC { /** * Return a list of the user's addressbooks display names * ! The addressBook displayName are not unique, please use getUserAddressBooks - * + * * @return array * @since 6.0.0 * @deprecated 16.0.0 - Use `$this->getUserAddressBooks()` instead @@ -142,11 +142,11 @@ namespace OC { /** * Return a list of the user's addressbooks - * + * * @return IAddressBook[] * @since 16.0.0 */ - public function getUserAddressBooks(): Array { + public function getUserAddressBooks(): array { $this->loadAddressBooks(); return $this->addressBooks; } diff --git a/lib/private/DB/AdapterPgSql.php b/lib/private/DB/AdapterPgSql.php index 628c91dbb9e..dd9c7dc9680 100644 --- a/lib/private/DB/AdapterPgSql.php +++ b/lib/private/DB/AdapterPgSql.php @@ -26,7 +26,6 @@ namespace OC\DB; - class AdapterPgSql extends Adapter { protected $compatModePre9_5 = null; @@ -36,8 +35,8 @@ class AdapterPgSql extends Adapter { const UNIX_TIMESTAMP_REPLACEMENT = 'cast(extract(epoch from current_timestamp) as integer)'; public function fixupStatement($statement) { - $statement = str_replace( '`', '"', $statement ); - $statement = str_ireplace( 'UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement ); + $statement = str_replace('`', '"', $statement); + $statement = str_ireplace('UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement); return $statement; } diff --git a/lib/private/DB/AdapterSqlite.php b/lib/private/DB/AdapterSqlite.php index 20d27732131..2d8715e90f5 100644 --- a/lib/private/DB/AdapterSqlite.php +++ b/lib/private/DB/AdapterSqlite.php @@ -43,10 +43,10 @@ class AdapterSqlite extends Adapter { public function fixupStatement($statement) { $statement = preg_replace('/`(\w+)` ILIKE \?/', 'LOWER($1) LIKE LOWER(?)', $statement); - $statement = str_replace( '`', '"', $statement ); - $statement = str_ireplace( 'NOW()', 'datetime(\'now\')', $statement ); + $statement = str_replace('`', '"', $statement); + $statement = str_ireplace('NOW()', 'datetime(\'now\')', $statement); $statement = str_ireplace('GREATEST(', 'MAX(', $statement); - $statement = str_ireplace( 'UNIX_TIMESTAMP()', 'strftime(\'%s\',\'now\')', $statement ); + $statement = str_ireplace('UNIX_TIMESTAMP()', 'strftime(\'%s\',\'now\')', $statement); return $statement; } diff --git a/lib/private/DB/Connection.php b/lib/private/DB/Connection.php index ed00bcd0e04..a0c0ac18481 100644 --- a/lib/private/DB/Connection.php +++ b/lib/private/DB/Connection.php @@ -160,7 +160,7 @@ class Connection extends ReconnectWrapper implements IDBConnection { * @param int $offset * @return \Doctrine\DBAL\Driver\Statement The prepared statement. */ - public function prepare( $statement, $limit=null, $offset=null ) { + public function prepare($statement, $limit=null, $offset=null) { if ($limit === -1) { $limit = null; } @@ -289,7 +289,7 @@ class Connection extends ReconnectWrapper implements IDBConnection { $insertQb = $this->getQueryBuilder(); $insertQb->insert($table) ->values( - array_map(function($value) use ($insertQb) { + array_map(function ($value) use ($insertQb) { return $insertQb->createNamedParameter($value, $this->getType($value)); }, array_merge($keys, $values)) ); @@ -383,7 +383,7 @@ class Connection extends ReconnectWrapper implements IDBConnection { * @param string $table table name without the prefix * @return bool */ - public function tableExists($table){ + public function tableExists($table) { $table = $this->tablePrefix . trim($table); $schema = $this->getSchemaManager(); return $schema->tablesExist([$table]); @@ -395,7 +395,7 @@ class Connection extends ReconnectWrapper implements IDBConnection { * @return string */ protected function replaceTablePrefix($statement) { - return str_replace( '*PREFIX*', $this->tablePrefix, $statement ); + return str_replace('*PREFIX*', $this->tablePrefix, $statement); } /** diff --git a/lib/private/DB/MigrationException.php b/lib/private/DB/MigrationException.php index 9e758f4e860..76d769e08be 100644 --- a/lib/private/DB/MigrationException.php +++ b/lib/private/DB/MigrationException.php @@ -23,7 +23,6 @@ namespace OC\DB; - class MigrationException extends \Exception { private $table; diff --git a/lib/private/DB/MigrationService.php b/lib/private/DB/MigrationService.php index 9f5b5bfe72b..dd719ef0a5b 100644 --- a/lib/private/DB/MigrationService.php +++ b/lib/private/DB/MigrationService.php @@ -468,12 +468,12 @@ class MigrationService { $instance = $this->createInstance($version); if (!$schemaOnly) { - $instance->preSchemaChange($this->output, function() { + $instance->preSchemaChange($this->output, function () { return new SchemaWrapper($this->connection); }, ['tablePrefix' => $this->connection->getPrefix()]); } - $toSchema = $instance->changeSchema($this->output, function() { + $toSchema = $instance->changeSchema($this->output, function () { return new SchemaWrapper($this->connection); }, ['tablePrefix' => $this->connection->getPrefix()]); @@ -488,7 +488,7 @@ class MigrationService { } if (!$schemaOnly) { - $instance->postSchemaChange($this->output, function() { + $instance->postSchemaChange($this->output, function () { return new SchemaWrapper($this->connection); }, ['tablePrefix' => $this->connection->getPrefix()]); } @@ -538,7 +538,7 @@ class MigrationService { if ($isUsingDefaultName) { $sequenceName = $table->getName() . '_' . implode('_', $primaryKey->getColumns()) . '_seq'; - $sequences = array_filter($sequences, function(Sequence $sequence) use ($sequenceName) { + $sequences = array_filter($sequences, function (Sequence $sequence) use ($sequenceName) { return $sequence->getName() !== $sequenceName; }); } diff --git a/lib/private/DB/MySQLMigrator.php b/lib/private/DB/MySQLMigrator.php index e178cfb55d8..fe56a9563e2 100644 --- a/lib/private/DB/MySQLMigrator.php +++ b/lib/private/DB/MySQLMigrator.php @@ -53,25 +53,25 @@ class MySQLMigrator extends Migrator { return $schemaDiff; } - /** - * Speed up migration test by disabling autocommit and unique indexes check - * - * @param \Doctrine\DBAL\Schema\Table $table - * @throws \OC\DB\MigrationException - */ - protected function checkTableMigrate(Table $table) { - $this->connection->exec('SET autocommit=0'); - $this->connection->exec('SET unique_checks=0'); + /** + * Speed up migration test by disabling autocommit and unique indexes check + * + * @param \Doctrine\DBAL\Schema\Table $table + * @throws \OC\DB\MigrationException + */ + protected function checkTableMigrate(Table $table) { + $this->connection->exec('SET autocommit=0'); + $this->connection->exec('SET unique_checks=0'); - try { - parent::checkTableMigrate($table); - } catch (\Exception $e) { - $this->connection->exec('SET unique_checks=1'); - $this->connection->exec('SET autocommit=1'); - throw new MigrationException($table->getName(), $e->getMessage()); - } - $this->connection->exec('SET unique_checks=1'); - $this->connection->exec('SET autocommit=1'); - } + try { + parent::checkTableMigrate($table); + } catch (\Exception $e) { + $this->connection->exec('SET unique_checks=1'); + $this->connection->exec('SET autocommit=1'); + throw new MigrationException($table->getName(), $e->getMessage()); + } + $this->connection->exec('SET unique_checks=1'); + $this->connection->exec('SET autocommit=1'); + } } diff --git a/lib/private/DB/MySqlTools.php b/lib/private/DB/MySqlTools.php index 69d95d4eed6..957afbaa06f 100644 --- a/lib/private/DB/MySqlTools.php +++ b/lib/private/DB/MySqlTools.php @@ -26,8 +26,8 @@ namespace OC\DB; use OCP\IDBConnection; /** -* Various MySQL specific helper functions. -*/ + * Various MySQL specific helper functions. + */ class MySqlTools { /** diff --git a/lib/private/DB/OracleConnection.php b/lib/private/DB/OracleConnection.php index cc1bf66d874..93a52d1772d 100644 --- a/lib/private/DB/OracleConnection.php +++ b/lib/private/DB/OracleConnection.php @@ -98,7 +98,7 @@ class OracleConnection extends Connection { * @param string $table table name without the prefix * @return bool */ - public function tableExists($table){ + public function tableExists($table) { $table = $this->tablePrefix . trim($table); $table = $this->quoteIdentifier($table); $schema = $this->getSchemaManager(); diff --git a/lib/private/DB/OracleMigrator.php b/lib/private/DB/OracleMigrator.php index 7695532a4b7..86d1f71c2b7 100644 --- a/lib/private/DB/OracleMigrator.php +++ b/lib/private/DB/OracleMigrator.php @@ -77,7 +77,7 @@ class OracleMigrator extends Migrator { return new Index( //TODO migrate existing uppercase indexes, then $this->connection->quoteIdentifier($index->getName()), $index->getName(), - array_map(function($columnName) { + array_map(function ($columnName) { return $this->connection->quoteIdentifier($columnName); }, $index->getColumns()), $index->isUnique(), @@ -96,11 +96,11 @@ class OracleMigrator extends Migrator { */ protected function quoteForeignKeyConstraint($fkc) { return new ForeignKeyConstraint( - array_map(function($columnName) { + array_map(function ($columnName) { return $this->connection->quoteIdentifier($columnName); }, $fkc->getLocalColumns()), $this->connection->quoteIdentifier($fkc->getForeignTableName()), - array_map(function($columnName) { + array_map(function ($columnName) { return $this->connection->quoteIdentifier($columnName); }, $fkc->getForeignColumns()), $fkc->getName(), @@ -118,16 +118,16 @@ class OracleMigrator extends Migrator { $schemaDiff = parent::getDiff($targetSchema, $connection); // oracle forces us to quote the identifiers - $schemaDiff->newTables = array_map(function(Table $table) { + $schemaDiff->newTables = array_map(function (Table $table) { return new Table( $this->connection->quoteIdentifier($table->getName()), - array_map(function(Column $column) { + array_map(function (Column $column) { return $this->quoteColumn($column); }, $table->getColumns()), - array_map(function(Index $index) { + array_map(function (Index $index) { return $this->quoteIndex($index); }, $table->getIndexes()), - array_map(function(ForeignKeyConstraint $fck) { + array_map(function (ForeignKeyConstraint $fck) { return $this->quoteForeignKeyConstraint($fck); }, $table->getForeignKeys()), 0, @@ -135,7 +135,7 @@ class OracleMigrator extends Migrator { ); }, $schemaDiff->newTables); - $schemaDiff->removedTables = array_map(function(Table $table) { + $schemaDiff->removedTables = array_map(function (Table $table) { return new Table( $this->connection->quoteIdentifier($table->getName()), $table->getColumns(), @@ -149,7 +149,7 @@ class OracleMigrator extends Migrator { foreach ($schemaDiff->changedTables as $tableDiff) { $tableDiff->name = $this->connection->quoteIdentifier($tableDiff->name); - $tableDiff->addedColumns = array_map(function(Column $column) { + $tableDiff->addedColumns = array_map(function (Column $column) { return $this->quoteColumn($column); }, $tableDiff->addedColumns); @@ -163,39 +163,39 @@ class OracleMigrator extends Migrator { return count($column->changedProperties) > 0; }); - $tableDiff->removedColumns = array_map(function(Column $column) { + $tableDiff->removedColumns = array_map(function (Column $column) { return $this->quoteColumn($column); }, $tableDiff->removedColumns); - $tableDiff->renamedColumns = array_map(function(Column $column) { + $tableDiff->renamedColumns = array_map(function (Column $column) { return $this->quoteColumn($column); }, $tableDiff->renamedColumns); - $tableDiff->addedIndexes = array_map(function(Index $index) { + $tableDiff->addedIndexes = array_map(function (Index $index) { return $this->quoteIndex($index); }, $tableDiff->addedIndexes); - $tableDiff->changedIndexes = array_map(function(Index $index) { + $tableDiff->changedIndexes = array_map(function (Index $index) { return $this->quoteIndex($index); }, $tableDiff->changedIndexes); - $tableDiff->removedIndexes = array_map(function(Index $index) { + $tableDiff->removedIndexes = array_map(function (Index $index) { return $this->quoteIndex($index); }, $tableDiff->removedIndexes); - $tableDiff->renamedIndexes = array_map(function(Index $index) { + $tableDiff->renamedIndexes = array_map(function (Index $index) { return $this->quoteIndex($index); }, $tableDiff->renamedIndexes); - $tableDiff->addedForeignKeys = array_map(function(ForeignKeyConstraint $fkc) { + $tableDiff->addedForeignKeys = array_map(function (ForeignKeyConstraint $fkc) { return $this->quoteForeignKeyConstraint($fkc); }, $tableDiff->addedForeignKeys); - $tableDiff->changedForeignKeys = array_map(function(ForeignKeyConstraint $fkc) { + $tableDiff->changedForeignKeys = array_map(function (ForeignKeyConstraint $fkc) { return $this->quoteForeignKeyConstraint($fkc); }, $tableDiff->changedForeignKeys); - $tableDiff->removedForeignKeys = array_map(function(ForeignKeyConstraint $fkc) { + $tableDiff->removedForeignKeys = array_map(function (ForeignKeyConstraint $fkc) { return $this->quoteForeignKeyConstraint($fkc); }, $tableDiff->removedForeignKeys); } diff --git a/lib/private/DB/PgSqlTools.php b/lib/private/DB/PgSqlTools.php index 5a9128bc5b2..724344ac2a1 100644 --- a/lib/private/DB/PgSqlTools.php +++ b/lib/private/DB/PgSqlTools.php @@ -25,11 +25,12 @@ */ namespace OC\DB; + use OCP\IConfig; /** -* Various PostgreSQL specific helper functions. -*/ + * Various PostgreSQL specific helper functions. + */ class PgSqlTools { /** @var \OCP\IConfig */ @@ -43,11 +44,11 @@ class PgSqlTools { } /** - * @brief Resynchronizes all sequences of a database after using INSERTs - * without leaving out the auto-incremented column. - * @param \OC\DB\Connection $conn - * @return null - */ + * @brief Resynchronizes all sequences of a database after using INSERTs + * without leaving out the auto-incremented column. + * @param \OC\DB\Connection $conn + * @return null + */ public function resynchronizeDatabaseSequences(Connection $conn) { $filterExpression = '/^' . preg_quote($this->config->getSystemValue('dbtableprefix', 'oc_')) . '/'; $databaseName = $conn->getDatabase(); diff --git a/lib/private/DB/QueryBuilder/ExpressionBuilder/MySqlExpressionBuilder.php b/lib/private/DB/QueryBuilder/ExpressionBuilder/MySqlExpressionBuilder.php index 666e99e7f8e..e7df321b102 100644 --- a/lib/private/DB/QueryBuilder/ExpressionBuilder/MySqlExpressionBuilder.php +++ b/lib/private/DB/QueryBuilder/ExpressionBuilder/MySqlExpressionBuilder.php @@ -24,7 +24,6 @@ namespace OC\DB\QueryBuilder\ExpressionBuilder; - use OC\DB\Connection; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\IDBConnection; diff --git a/lib/private/DB/QueryBuilder/ExpressionBuilder/OCIExpressionBuilder.php b/lib/private/DB/QueryBuilder/ExpressionBuilder/OCIExpressionBuilder.php index 12719b2aaad..2aa007dba04 100644 --- a/lib/private/DB/QueryBuilder/ExpressionBuilder/OCIExpressionBuilder.php +++ b/lib/private/DB/QueryBuilder/ExpressionBuilder/OCIExpressionBuilder.php @@ -24,7 +24,6 @@ namespace OC\DB\QueryBuilder\ExpressionBuilder; - use OC\DB\QueryBuilder\QueryFunction; use OCP\DB\QueryBuilder\ILiteral; use OCP\DB\QueryBuilder\IParameter; diff --git a/lib/private/DB/QueryBuilder/ExpressionBuilder/PgSqlExpressionBuilder.php b/lib/private/DB/QueryBuilder/ExpressionBuilder/PgSqlExpressionBuilder.php index a59cd591db0..fbf76da8690 100644 --- a/lib/private/DB/QueryBuilder/ExpressionBuilder/PgSqlExpressionBuilder.php +++ b/lib/private/DB/QueryBuilder/ExpressionBuilder/PgSqlExpressionBuilder.php @@ -24,7 +24,6 @@ namespace OC\DB\QueryBuilder\ExpressionBuilder; - use OC\DB\QueryBuilder\QueryFunction; use OCP\DB\QueryBuilder\IQueryBuilder; diff --git a/lib/private/DB/QueryBuilder/ExpressionBuilder/SqliteExpressionBuilder.php b/lib/private/DB/QueryBuilder/ExpressionBuilder/SqliteExpressionBuilder.php index b82b4d9eb3f..1fa0d79663a 100644 --- a/lib/private/DB/QueryBuilder/ExpressionBuilder/SqliteExpressionBuilder.php +++ b/lib/private/DB/QueryBuilder/ExpressionBuilder/SqliteExpressionBuilder.php @@ -23,7 +23,6 @@ namespace OC\DB\QueryBuilder\ExpressionBuilder; - class SqliteExpressionBuilder extends ExpressionBuilder { /** * @inheritdoc diff --git a/lib/private/DB/SchemaWrapper.php b/lib/private/DB/SchemaWrapper.php index f7f204a564c..eb24cc6f7aa 100644 --- a/lib/private/DB/SchemaWrapper.php +++ b/lib/private/DB/SchemaWrapper.php @@ -64,7 +64,7 @@ class SchemaWrapper implements ISchemaWrapper { */ public function getTableNamesWithoutPrefix() { $tableNames = $this->schema->getTableNames(); - return array_map(function($tableName) { + return array_map(function ($tableName) { if (strpos($tableName, $this->connection->getPrefix()) === 0) { return substr($tableName, strlen($this->connection->getPrefix())); } diff --git a/lib/private/Dashboard/DashboardManager.php b/lib/private/Dashboard/DashboardManager.php index 3f2b04bb96d..6491779bce7 100644 --- a/lib/private/Dashboard/DashboardManager.php +++ b/lib/private/Dashboard/DashboardManager.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OC\Dashboard; - use OCP\Dashboard\Exceptions\DashboardAppNotAvailableException; use OCP\Dashboard\IDashboardManager; use OCP\Dashboard\Model\IWidgetConfig; diff --git a/lib/private/DateTimeZone.php b/lib/private/DateTimeZone.php index 23fb8ae272f..971a1a97334 100644 --- a/lib/private/DateTimeZone.php +++ b/lib/private/DateTimeZone.php @@ -24,7 +24,6 @@ namespace OC; - use OCP\IConfig; use OCP\IDateTimeZone; use OCP\ILogger; @@ -120,7 +119,7 @@ class DateTimeZone implements IDateTimeZone { * Get the default timezone of the server * * Falls back to UTC if it is not yet set. - * + * * @return string */ protected function getDefaultTimeZone() { diff --git a/lib/private/DirectEditing/Token.php b/lib/private/DirectEditing/Token.php index add6f5b471c..1c0b99b757d 100644 --- a/lib/private/DirectEditing/Token.php +++ b/lib/private/DirectEditing/Token.php @@ -23,7 +23,6 @@ namespace OC\DirectEditing; - use OCP\DirectEditing\IToken; use OCP\Files\File; diff --git a/lib/private/Encryption/EncryptionWrapper.php b/lib/private/Encryption/EncryptionWrapper.php index e5bc0e868bd..6389e996c1d 100644 --- a/lib/private/Encryption/EncryptionWrapper.php +++ b/lib/private/Encryption/EncryptionWrapper.php @@ -24,7 +24,6 @@ namespace OC\Encryption; - use OC\Files\Filesystem; use OC\Files\Storage\Wrapper\Encryption; use OC\Files\View; diff --git a/lib/private/Encryption/Manager.php b/lib/private/Encryption/Manager.php index 63d35e6dd86..52fc23de947 100644 --- a/lib/private/Encryption/Manager.php +++ b/lib/private/Encryption/Manager.php @@ -128,7 +128,7 @@ class Manager implements IManager { return true; } - /** + /** * Registers an callback function which must return an encryption module instance * * @param string $id diff --git a/lib/private/Encryption/Util.php b/lib/private/Encryption/Util.php index 9cc78e7ba77..937a77bca7a 100644 --- a/lib/private/Encryption/Util.php +++ b/lib/private/Encryption/Util.php @@ -253,7 +253,7 @@ class Util { public function stripPartialFileExtension($path) { $extension = pathinfo($path, PATHINFO_EXTENSION); - if ( $extension === 'part') { + if ($extension === 'part') { $newLength = strlen($path) - 5; // 5 = strlen(".part") $fPath = substr($path, 0, $newLength); @@ -275,7 +275,7 @@ class Util { $result = []; if (in_array('all', $users)) { $users = $this->userManager->search('', null, null); - $result = array_map(function(IUser $user) { + $result = array_map(function (IUser $user) { return $user->getUID(); }, $users); } else { diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php index 11f7eedea26..a6daec2a8f3 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -554,7 +554,7 @@ class Cache implements ICache { */ private function removeChildren(ICacheEntry $entry) { $children = $this->getFolderContentsById($entry->getId()); - $childIds = array_map(function(ICacheEntry $cacheEntry) { + $childIds = array_map(function (ICacheEntry $cacheEntry) { return $cacheEntry->getId(); }, $children); $childFolders = array_filter($children, function ($child) { diff --git a/lib/private/Files/Cache/Watcher.php b/lib/private/Files/Cache/Watcher.php index cd375572b08..6270f03ca92 100644 --- a/lib/private/Files/Cache/Watcher.php +++ b/lib/private/Files/Cache/Watcher.php @@ -26,6 +26,7 @@ */ namespace OC\Files\Cache; + use OCP\Files\Cache\ICacheEntry; use OCP\Files\Cache\IWatcher; diff --git a/lib/private/Files/Cache/Wrapper/JailPropagator.php b/lib/private/Files/Cache/Wrapper/JailPropagator.php index 9322d9e610b..956d187783a 100644 --- a/lib/private/Files/Cache/Wrapper/JailPropagator.php +++ b/lib/private/Files/Cache/Wrapper/JailPropagator.php @@ -24,7 +24,6 @@ namespace OC\Files\Cache\Wrapper; - use OC\Files\Cache\Propagator; use OC\Files\Storage\Wrapper\Jail; diff --git a/lib/private/Files/Config/CachedMountFileInfo.php b/lib/private/Files/Config/CachedMountFileInfo.php index 99df663a4e6..7bae52bb65d 100644 --- a/lib/private/Files/Config/CachedMountFileInfo.php +++ b/lib/private/Files/Config/CachedMountFileInfo.php @@ -24,7 +24,6 @@ namespace OC\Files\Config; - use OCP\Files\Config\ICachedMountFileInfo; use OCP\IUser; diff --git a/lib/private/Files/Filesystem.php b/lib/private/Files/Filesystem.php index 8fddbf71200..44da2e6f20f 100644 --- a/lib/private/Files/Filesystem.php +++ b/lib/private/Files/Filesystem.php @@ -828,7 +828,7 @@ class Filesystem { $patterns = [ '/\\\\/s', // no windows style slashes '/\/\.(\/\.)?\//s', // remove '/./' - '/\/{2,}/s', // remove squence of slashes + '/\/{2,}/s', // remove sequence of slashes '/\/\.$/s', // remove trailing /. ]; diff --git a/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php b/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php index f7d565d5cd1..98b99efcb5a 100644 --- a/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php @@ -34,14 +34,14 @@ class HomeObjectStoreStorage extends ObjectStoreStorage implements \OCP\Files\IH * @param array $params */ public function __construct($params) { - if ( ! isset($params['user']) || ! $params['user'] instanceof User) { + if (! isset($params['user']) || ! $params['user'] instanceof User) { throw new \Exception('missing user object in parameters'); } $this->user = $params['user']; parent::__construct($params); } - public function getId () { + public function getId() { return 'object::user:' . $this->user->getUID(); } diff --git a/lib/private/Files/ObjectStore/NoopScanner.php b/lib/private/Files/ObjectStore/NoopScanner.php index 2625703b5c4..7a253c82c5b 100644 --- a/lib/private/Files/ObjectStore/NoopScanner.php +++ b/lib/private/Files/ObjectStore/NoopScanner.php @@ -26,6 +26,7 @@ */ namespace OC\Files\ObjectStore; + use OC\Files\Cache\Scanner; use OC\Files\Storage\Storage; diff --git a/lib/private/Files/ObjectStore/SwiftV2CachingAuthService.php b/lib/private/Files/ObjectStore/SwiftV2CachingAuthService.php index 1343531e384..635d0908c9a 100644 --- a/lib/private/Files/ObjectStore/SwiftV2CachingAuthService.php +++ b/lib/private/Files/ObjectStore/SwiftV2CachingAuthService.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OC\Files\ObjectStore; - use OpenStack\Identity\v2\Service; class SwiftV2CachingAuthService extends Service { diff --git a/lib/private/Files/Search/SearchOrder.php b/lib/private/Files/Search/SearchOrder.php index 7a7eb01ed94..4bff8ba1b6c 100644 --- a/lib/private/Files/Search/SearchOrder.php +++ b/lib/private/Files/Search/SearchOrder.php @@ -23,7 +23,6 @@ namespace OC\Files\Search; - use OCP\Files\Search\ISearchOrder; class SearchOrder implements ISearchOrder { diff --git a/lib/private/Files/SimpleFS/SimpleFolder.php b/lib/private/Files/SimpleFS/SimpleFolder.php index 169a8d96fd3..7196b55ea12 100644 --- a/lib/private/Files/SimpleFS/SimpleFolder.php +++ b/lib/private/Files/SimpleFS/SimpleFolder.php @@ -51,7 +51,7 @@ class SimpleFolder implements ISimpleFolder { public function getDirectoryListing() { $listing = $this->folder->getDirectoryListing(); - $fileListing = array_map(function(Node $file) { + $fileListing = array_map(function (Node $file) { if ($file instanceof File) { return new SimpleFile($file); } diff --git a/lib/private/Files/Storage/CommonTest.php b/lib/private/Files/Storage/CommonTest.php index 4ed9364a4b3..164738d9478 100644 --- a/lib/private/Files/Storage/CommonTest.php +++ b/lib/private/Files/Storage/CommonTest.php @@ -43,7 +43,7 @@ class CommonTest extends \OC\Files\Storage\Common{ $this->storage=new \OC\Files\Storage\Local($params); } - public function getId(){ + public function getId() { return 'test::'.$this->storage->getId(); } public function mkdir($path) { diff --git a/lib/private/Files/Storage/Storage.php b/lib/private/Files/Storage/Storage.php index 748253f21bb..7e5a0cef4d7 100644 --- a/lib/private/Files/Storage/Storage.php +++ b/lib/private/Files/Storage/Storage.php @@ -23,6 +23,7 @@ */ namespace OC\Files\Storage; + use OCP\Lock\ILockingProvider; /** diff --git a/lib/private/Files/Stream/SeekableHttpStream.php b/lib/private/Files/Stream/SeekableHttpStream.php index fdcd9ea8cfb..113ba19a17a 100644 --- a/lib/private/Files/Stream/SeekableHttpStream.php +++ b/lib/private/Files/Stream/SeekableHttpStream.php @@ -149,15 +149,25 @@ class SeekableHttpStream implements File { } public function stream_stat() { - return fstat($this->current); + if (is_resource($this->current)) { + return fstat($this->current); + } else { + return false; + } } public function stream_eof() { - return feof($this->current); + if (is_resource($this->current)) { + return feof($this->current); + } else { + return true; + } } public function stream_close() { - fclose($this->current); + if (is_resource($this->current)) { + fclose($this->current); + } } public function stream_write($data) { diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index e3f704a7cbc..881bf1a2126 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -670,7 +670,7 @@ class View { list($storage, $internalPath) = $this->resolvePath($path); $target = $storage->fopen($internalPath, 'w'); if ($target) { - list (, $result) = \OC_Helper::streamCopy($data, $target); + list(, $result) = \OC_Helper::streamCopy($data, $target); fclose($target); fclose($data); @@ -1454,7 +1454,7 @@ class View { $sharingDisabled = \OCP\Util::isSharingDisabledForUser(); - $fileNames = array_map(function(ICacheEntry $content) { + $fileNames = array_map(function (ICacheEntry $content) { return $content->getName(); }, $contents); /** @@ -1735,7 +1735,7 @@ class View { // put non shared mounts in front of the shared mount // this prevent unneeded recursion into shares - usort($mounts, function(IMountPoint $a, IMountPoint $b) { + usort($mounts, function (IMountPoint $a, IMountPoint $b) { return $a instanceof SharedMount && (!$b instanceof SharedMount) ? 1 : -1; }); diff --git a/lib/private/FullTextSearch/FullTextSearchManager.php b/lib/private/FullTextSearch/FullTextSearchManager.php index a67d23f6af6..4af70d97260 100644 --- a/lib/private/FullTextSearch/FullTextSearchManager.php +++ b/lib/private/FullTextSearch/FullTextSearchManager.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OC\FullTextSearch; - use OCP\FullTextSearch\Exceptions\FullTextSearchAppNotAvailableException; use OCP\FullTextSearch\IFullTextSearchManager; use OCP\FullTextSearch\Model\IIndex; diff --git a/lib/private/FullTextSearch/Model/DocumentAccess.php b/lib/private/FullTextSearch/Model/DocumentAccess.php index 2b74991b717..d4c7a06d079 100644 --- a/lib/private/FullTextSearch/Model/DocumentAccess.php +++ b/lib/private/FullTextSearch/Model/DocumentAccess.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OC\FullTextSearch\Model; - use JsonSerializable; use OCP\FullTextSearch\Model\IDocumentAccess; diff --git a/lib/private/FullTextSearch/Model/IndexDocument.php b/lib/private/FullTextSearch/Model/IndexDocument.php index 048696e4d4b..7c7847b7463 100644 --- a/lib/private/FullTextSearch/Model/IndexDocument.php +++ b/lib/private/FullTextSearch/Model/IndexDocument.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OC\FullTextSearch\Model; - use JsonSerializable; use OCP\FullTextSearch\Model\IDocumentAccess; use OCP\FullTextSearch\Model\IIndex; diff --git a/lib/private/FullTextSearch/Model/SearchOption.php b/lib/private/FullTextSearch/Model/SearchOption.php index a61e823fb74..1ff3fbba272 100644 --- a/lib/private/FullTextSearch/Model/SearchOption.php +++ b/lib/private/FullTextSearch/Model/SearchOption.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OC\FullTextSearch\Model; - use JsonSerializable; use OCP\FullTextSearch\Model\ISearchOption; diff --git a/lib/private/FullTextSearch/Model/SearchRequestSimpleQuery.php b/lib/private/FullTextSearch/Model/SearchRequestSimpleQuery.php index 2ffc2ee359d..19be494d82f 100644 --- a/lib/private/FullTextSearch/Model/SearchRequestSimpleQuery.php +++ b/lib/private/FullTextSearch/Model/SearchRequestSimpleQuery.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OC\FullTextSearch\Model; - use JsonSerializable; use OCP\FullTextSearch\Model\ISearchRequestSimpleQuery; diff --git a/lib/private/FullTextSearch/Model/SearchTemplate.php b/lib/private/FullTextSearch/Model/SearchTemplate.php index 9060a82046f..4940e57c281 100644 --- a/lib/private/FullTextSearch/Model/SearchTemplate.php +++ b/lib/private/FullTextSearch/Model/SearchTemplate.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OC\FullTextSearch\Model; - use JsonSerializable; use OCP\FullTextSearch\IFullTextSearchProvider; use OCP\FullTextSearch\Model\ISearchOption; diff --git a/lib/private/GlobalScale/Config.php b/lib/private/GlobalScale/Config.php index c1a70c94647..f886ac8ff84 100644 --- a/lib/private/GlobalScale/Config.php +++ b/lib/private/GlobalScale/Config.php @@ -23,7 +23,6 @@ namespace OC\GlobalScale; - use OCP\IConfig; class Config implements \OCP\GlobalScale\IConfig { diff --git a/lib/private/Group/Backend.php b/lib/private/Group/Backend.php index 024366a46be..4e2f912e7fc 100644 --- a/lib/private/Group/Backend.php +++ b/lib/private/Group/Backend.php @@ -45,15 +45,15 @@ abstract class Backend implements \OCP\GroupInterface { ]; /** - * Get all supported actions - * @return int bitwise-or'ed actions - * - * Returns the supported actions as int to be - * compared with \OC\Group\Backend::CREATE_GROUP etc. - */ + * Get all supported actions + * @return int bitwise-or'ed actions + * + * Returns the supported actions as int to be + * compared with \OC\Group\Backend::CREATE_GROUP etc. + */ public function getSupportedActions() { $actions = 0; - foreach($this->possibleActions AS $action => $methodName) { + foreach($this->possibleActions as $action => $methodName) { if(method_exists($this, $methodName)) { $actions |= $action; } @@ -63,13 +63,13 @@ abstract class Backend implements \OCP\GroupInterface { } /** - * Check if backend implements actions - * @param int $actions bitwise-or'ed actions - * @return bool - * - * Returns the supported actions as int to be - * compared with \OC\Group\Backend::CREATE_GROUP etc. - */ + * Check if backend implements actions + * @param int $actions bitwise-or'ed actions + * @return bool + * + * Returns the supported actions as int to be + * compared with \OC\Group\Backend::CREATE_GROUP etc. + */ public function implementsActions($actions) { return (bool)($this->getSupportedActions() & $actions); } diff --git a/lib/private/Group/Database.php b/lib/private/Group/Database.php index 8afd2c4aed2..99654b5d1f2 100644 --- a/lib/private/Group/Database.php +++ b/lib/private/Group/Database.php @@ -62,14 +62,14 @@ use OCP\IDBConnection; */ class Database extends ABackend implements IAddToGroupBackend, - ICountDisabledInGroup, - ICountUsersBackend, - ICreateGroupBackend, - IDeleteGroupBackend, - IGetDisplayNameBackend, - IGroupDetailsBackend, - IRemoveFromGroupBackend, - ISetDisplayNameBackend { + ICountDisabledInGroup, + ICountUsersBackend, + ICreateGroupBackend, + IDeleteGroupBackend, + IGetDisplayNameBackend, + IGroupDetailsBackend, + IRemoveFromGroupBackend, + ISetDisplayNameBackend { /** @var string[] */ private $groupCache = []; @@ -165,7 +165,7 @@ class Database extends ABackend * * Checks whether the user is member of a group or not. */ - public function inGroup( $uid, $gid ) { + public function inGroup($uid, $gid) { $this->fixDI(); // check @@ -194,7 +194,7 @@ class Database extends ABackend $this->fixDI(); // No duplicate entries! - if( !$this->inGroup( $uid, $gid )) { + if(!$this->inGroup($uid, $gid)) { $qb = $this->dbConn->getQueryBuilder(); $qb->insert('group_user') ->setValue('uid', $qb->createNamedParameter($uid)) @@ -234,7 +234,7 @@ class Database extends ABackend * This function fetches all groups a user belongs to. It does not check * if the user exists at all. */ - public function getUserGroups( $uid ) { + public function getUserGroups($uid) { //guests has empty or null $uid if ($uid === null || $uid === '') { return []; @@ -250,7 +250,7 @@ class Database extends ABackend ->execute(); $groups = []; - while( $row = $cursor->fetch()) { + while($row = $cursor->fetch()) { $groups[] = $row['gid']; $this->groupCache[$row['gid']] = $row['gid']; } diff --git a/lib/private/Group/Group.php b/lib/private/Group/Group.php index 90b4221b414..9eb1b616609 100644 --- a/lib/private/Group/Group.php +++ b/lib/private/Group/Group.php @@ -285,7 +285,7 @@ class Group implements IGroup { public function countDisabled() { $users = false; foreach ($this->backends as $backend) { - if($backend instanceOf ICountDisabledInGroup) { + if($backend instanceof ICountDisabledInGroup) { if($users === false) { //we could directly add to a bool variable, but this would //be ugly @@ -398,7 +398,7 @@ class Group implements IGroup { * @since 16.0.0 */ public function hideFromCollaboration(): bool { - return array_reduce($this->backends, function(bool $hide, GroupInterface $backend) { + return array_reduce($this->backends, function (bool $hide, GroupInterface $backend) { return $hide | ($backend instanceof IHideFromCollaborationBackend && $backend->hideGroup($this->gid)); }, false); } diff --git a/lib/private/Group/MetaData.php b/lib/private/Group/MetaData.php index 97d71b51f98..3a2c08b0878 100644 --- a/lib/private/Group/MetaData.php +++ b/lib/private/Group/MetaData.php @@ -165,13 +165,13 @@ class MetaData { */ private function generateGroupMetaData(\OCP\IGroup $group, $userSearch) { return [ - 'id' => $group->getGID(), - 'name' => $group->getDisplayName(), - 'usercount' => $this->sorting === self::SORT_USERCOUNT ? $group->count($userSearch) : 0, - 'disabled' => $group->countDisabled(), - 'canAdd' => $group->canAddUser(), - 'canRemove' => $group->canRemoveUser(), - ]; + 'id' => $group->getGID(), + 'name' => $group->getDisplayName(), + 'usercount' => $this->sorting === self::SORT_USERCOUNT ? $group->count($userSearch) : 0, + 'disabled' => $group->countDisabled(), + 'canAdd' => $group->canAddUser(), + 'canRemove' => $group->canRemoveUser(), + ]; } /** diff --git a/lib/private/Installer.php b/lib/private/Installer.php index b3919f22d03..78925a56a2e 100644 --- a/lib/private/Installer.php +++ b/lib/private/Installer.php @@ -479,7 +479,7 @@ class Installer { * this has to be done by the function oc_app_uninstall(). */ public function removeApp($appId) { - if($this->isDownloaded( $appId )) { + if($this->isDownloaded($appId)) { if (\OC::$server->getAppManager()->isShipped($appId)) { return false; } @@ -528,10 +528,10 @@ class Installer { $config = \OC::$server->getConfig(); $errors = []; foreach(\OC::$APPSROOTS as $app_dir) { - if($dir = opendir( $app_dir['path'] )) { - while( false !== ( $filename = readdir( $dir ))) { - if( $filename[0] !== '.' and is_dir($app_dir['path']."/$filename") ) { - if( file_exists( $app_dir['path']."/$filename/appinfo/info.xml" )) { + if($dir = opendir($app_dir['path'])) { + while(false !== ($filename = readdir($dir))) { + if($filename[0] !== '.' and is_dir($app_dir['path']."/$filename")) { + if(file_exists($app_dir['path']."/$filename/appinfo/info.xml")) { if($config->getAppValue($filename, "installed_version", null) === null) { $info=OC_App::getAppInfo($filename); $enabled = isset($info['default_enable']); @@ -556,7 +556,7 @@ class Installer { } } } - closedir( $dir ); + closedir($dir); } } @@ -623,7 +623,7 @@ class Installer { * @param string $script */ private static function includeAppScript($script) { - if ( file_exists($script) ){ + if (file_exists($script)){ include $script; } } diff --git a/lib/private/IntegrityCheck/Checker.php b/lib/private/IntegrityCheck/Checker.php index 57a80e6f4bd..725d72d9c79 100644 --- a/lib/private/IntegrityCheck/Checker.php +++ b/lib/private/IntegrityCheck/Checker.php @@ -239,10 +239,10 @@ class Checker { $signature = $privateKey->sign(json_encode($hashes)); return [ - 'hashes' => $hashes, - 'signature' => base64_encode($signature), - 'certificate' => $certificate->saveX509($certificate->currentCert), - ]; + 'hashes' => $hashes, + 'signature' => base64_encode($signature), + 'certificate' => $certificate->saveX509($certificate->currentCert), + ]; } /** @@ -509,10 +509,10 @@ class Checker { ); } catch (\Exception $e) { $result = [ - 'EXCEPTION' => [ - 'class' => \get_class($e), - 'message' => $e->getMessage(), - ], + 'EXCEPTION' => [ + 'class' => \get_class($e), + 'message' => $e->getMessage(), + ], ]; } $this->storeResults($appId, $result); @@ -559,10 +559,10 @@ class Checker { ); } catch (\Exception $e) { $result = [ - 'EXCEPTION' => [ - 'class' => \get_class($e), - 'message' => $e->getMessage(), - ], + 'EXCEPTION' => [ + 'class' => \get_class($e), + 'message' => $e->getMessage(), + ], ]; } $this->storeResults('core', $result); diff --git a/lib/private/L10N/Factory.php b/lib/private/L10N/Factory.php index 91420b8d766..5624155dadd 100644 --- a/lib/private/L10N/Factory.php +++ b/lib/private/L10N/Factory.php @@ -114,7 +114,7 @@ class Factory implements IFactory { * @return \OCP\IL10N */ public function get($app, $lang = null, $locale = null) { - return new LazyL10N(function() use ($app, $lang, $locale) { + return new LazyL10N(function () use ($app, $lang, $locale) { $app = \OC_App::cleanAppId($app); if ($lang !== null) { @@ -369,7 +369,7 @@ class Factory implements IFactory { } $locales = $this->findAvailableLocales(); - $userLocale = array_filter($locales, function($value) use ($locale) { + $userLocale = array_filter($locales, function ($value) use ($locale) { return $locale === $value['code']; }); @@ -526,10 +526,10 @@ class Factory implements IFactory { return $this->pluralFunctions[$string]; } - if (preg_match( '/^\s*nplurals\s*=\s*(\d+)\s*;\s*plural=(.*)$/u', $string, $matches)) { + if (preg_match('/^\s*nplurals\s*=\s*(\d+)\s*;\s*plural=(.*)$/u', $string, $matches)) { // sanitize - $nplurals = preg_replace( '/[^0-9]/', '', $matches[1] ); - $plural = preg_replace( '#[^n0-9:\(\)\?\|\&=!<>+*/\%-]#', '', $matches[2] ); + $nplurals = preg_replace('/[^0-9]/', '', $matches[1]); + $plural = preg_replace('#[^n0-9:\(\)\?\|\&=!<>+*/\%-]#', '', $matches[2]); $body = str_replace( [ 'plural', 'n', '$n$plurals', ], @@ -545,7 +545,7 @@ class Factory implements IFactory { $length = strlen($body); for($i = 0; $i < $length; $i++) { $ch = $body[$i]; - switch ( $ch ) { + switch ($ch) { case '?': $res .= ' ? ('; $p++; @@ -554,7 +554,7 @@ class Factory implements IFactory { $res .= ') : ('; break; case ';': - $res .= str_repeat( ')', $p ) . ';'; + $res .= str_repeat(')', $p) . ';'; $p = 0; break; default: @@ -627,7 +627,7 @@ class Factory implements IFactory { ksort($commonLanguages); // sort now by displayed language not the iso-code - usort( $languages, function ($a, $b) { + usort($languages, function ($a, $b) { if ($a['code'] === $a['name'] && $b['code'] !== $b['name']) { // If a doesn't have a name, but b does, list b before a return 1; diff --git a/lib/private/L10N/L10N.php b/lib/private/L10N/L10N.php index 519ff45292b..ee339ba8840 100644 --- a/lib/private/L10N/L10N.php +++ b/lib/private/L10N/L10N.php @@ -221,7 +221,7 @@ class L10N implements IL10N { public function getPluralFormFunction(): \Closure { if (\is_null($this->pluralFormFunction)) { $lang = $this->getLanguageCode(); - $this->pluralFormFunction = function($n) use ($lang) { + $this->pluralFormFunction = function ($n) use ($lang) { return PluralizationRules::get($n, $lang); }; } diff --git a/lib/private/LargeFileHelper.php b/lib/private/LargeFileHelper.php index 7f6a329c22d..fb4ef1ce4f7 100755 --- a/lib/private/LargeFileHelper.php +++ b/lib/private/LargeFileHelper.php @@ -34,23 +34,23 @@ namespace OC; */ class LargeFileHelper { /** - * pow(2, 53) as a base-10 string. - * @var string - */ + * pow(2, 53) as a base-10 string. + * @var string + */ const POW_2_53 = '9007199254740992'; /** - * pow(2, 53) - 1 as a base-10 string. - * @var string - */ + * pow(2, 53) - 1 as a base-10 string. + * @var string + */ const POW_2_53_MINUS_1 = '9007199254740991'; /** - * @brief Checks whether our assumptions hold on the PHP platform we are on. - * - * @throws \RunTimeException if our assumptions do not hold on the current - * PHP platform. - */ + * @brief Checks whether our assumptions hold on the PHP platform we are on. + * + * @throws \RunTimeException if our assumptions do not hold on the current + * PHP platform. + */ public function __construct() { $pow_2_53 = (float)self::POW_2_53_MINUS_1 + 1.0; if ($this->formatUnsignedInteger($pow_2_53) !== self::POW_2_53) { @@ -61,16 +61,16 @@ class LargeFileHelper { } /** - * @brief Formats a signed integer or float as an unsigned integer base-10 - * string. Passed strings will be checked for being base-10. - * - * @param int|float|string $number Number containing unsigned integer data - * - * @throws \UnexpectedValueException if $number is not a float, not an int - * and not a base-10 string. - * - * @return string Unsigned integer base-10 string - */ + * @brief Formats a signed integer or float as an unsigned integer base-10 + * string. Passed strings will be checked for being base-10. + * + * @param int|float|string $number Number containing unsigned integer data + * + * @throws \UnexpectedValueException if $number is not a float, not an int + * and not a base-10 string. + * + * @return string Unsigned integer base-10 string + */ public function formatUnsignedInteger($number) { if (is_float($number)) { // Undo the effect of the php.ini setting 'precision'. @@ -88,14 +88,14 @@ class LargeFileHelper { } /** - * @brief Tries to get the size of a file via various workarounds that - * even work for large files on 32-bit platforms. - * - * @param string $filename Path to the file. - * - * @return null|int|float Number of bytes as number (float or int) or - * null on failure. - */ + * @brief Tries to get the size of a file via various workarounds that + * even work for large files on 32-bit platforms. + * + * @param string $filename Path to the file. + * + * @return null|int|float Number of bytes as number (float or int) or + * null on failure. + */ public function getFileSize($filename) { $fileSize = $this->getFileSizeViaCurl($filename); if (!is_null($fileSize)) { @@ -109,13 +109,13 @@ class LargeFileHelper { } /** - * @brief Tries to get the size of a file via a CURL HEAD request. - * - * @param string $fileName Path to the file. - * - * @return null|int|float Number of bytes as number (float or int) or - * null on failure. - */ + * @brief Tries to get the size of a file via a CURL HEAD request. + * + * @param string $fileName Path to the file. + * + * @return null|int|float Number of bytes as number (float or int) or + * null on failure. + */ public function getFileSizeViaCurl($fileName) { if (\OC::$server->getIniWrapper()->getString('open_basedir') === '') { $encodedFileName = rawurlencode($fileName); @@ -137,13 +137,13 @@ class LargeFileHelper { } /** - * @brief Tries to get the size of a file via an exec() call. - * - * @param string $filename Path to the file. - * - * @return null|int|float Number of bytes as number (float or int) or - * null on failure. - */ + * @brief Tries to get the size of a file via an exec() call. + * + * @param string $filename Path to the file. + * + * @return null|int|float Number of bytes as number (float or int) or + * null on failure. + */ public function getFileSizeViaExec($filename) { if (\OC_Helper::is_function_enabled('exec')) { $os = strtolower(php_uname('s')); @@ -160,15 +160,15 @@ class LargeFileHelper { } /** - * @brief Gets the size of a file via a filesize() call and converts - * negative signed int to positive float. As the result of filesize() - * will wrap around after a file size of 2^32 bytes = 4 GiB, this - * should only be used as a last resort. - * - * @param string $filename Path to the file. - * - * @return int|float Number of bytes as number (float or int). - */ + * @brief Gets the size of a file via a filesize() call and converts + * negative signed int to positive float. As the result of filesize() + * will wrap around after a file size of 2^32 bytes = 4 GiB, this + * should only be used as a last resort. + * + * @param string $filename Path to the file. + * + * @return int|float Number of bytes as number (float or int). + */ public function getFileSizeNative($filename) { $result = filesize($filename); if ($result < 0) { diff --git a/lib/private/Log/File.php b/lib/private/Log/File.php index 5fccb36acb1..57b4e9353ef 100644 --- a/lib/private/Log/File.php +++ b/lib/private/Log/File.php @@ -35,6 +35,7 @@ */ namespace OC\Log; + use OC\SystemConfig; use OCP\ILogger; use OCP\Log\IFileBased; diff --git a/lib/private/Log/PsrLoggerAdapter.php b/lib/private/Log/PsrLoggerAdapter.php new file mode 100644 index 00000000000..4bfd9a2a246 --- /dev/null +++ b/lib/private/Log/PsrLoggerAdapter.php @@ -0,0 +1,166 @@ +<?php + +declare(strict_types=1); + +/** + * @copyright 2020 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @author 2020 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program 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 program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace OC\Log; + +use OCP\ILogger; +use Psr\Log\InvalidArgumentException; +use Psr\Log\LoggerInterface; + +final class PsrLoggerAdapter implements LoggerInterface { + + /** @var ILogger */ + private $logger; + + public function __construct(ILogger $logger) { + $this->logger = $logger; + } + + /** + * System is unusable. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function emergency($message, array $context = []): void { + $this->logger->emergency($message, $context); + } + + /** + * Action must be taken immediately. + * + * Example: Entire website down, database unavailable, etc. This should + * trigger the SMS alerts and wake you up. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function alert($message, array $context = []) { + $this->logger->alert($message, $context); + } + + /** + * Critical conditions. + * + * Example: Application component unavailable, unexpected exception. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function critical($message, array $context = []) { + $this->logger->critical($message, $context); + } + + /** + * Runtime errors that do not require immediate action but should typically + * be logged and monitored. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function error($message, array $context = []) { + $this->logger->error($message, $context); + } + + /** + * Exceptional occurrences that are not errors. + * + * Example: Use of deprecated APIs, poor use of an API, undesirable things + * that are not necessarily wrong. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function warning($message, array $context = []) { + $this->logger->warning($message, $context); + } + + /** + * Normal but significant events. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function notice($message, array $context = []) { + $this->logger->notice($message, $context); + } + + /** + * Interesting events. + * + * Example: User logs in, SQL logs. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function info($message, array $context = []) { + $this->logger->info($message, $context); + } + + /** + * Detailed debug information. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function debug($message, array $context = []) { + $this->logger->debug($message, $context); + } + + /** + * Logs with an arbitrary level. + * + * @param mixed $level + * @param string $message + * @param array $context + * + * @return void + * + * @throws InvalidArgumentException + */ + public function log($level, $message, array $context = []) { + if (!is_int($level) || $level < ILogger::DEBUG || $level > ILogger::FATAL) { + throw new InvalidArgumentException('Nextcloud allows only integer log levels'); + } + $this->logger->log($level, $message, $context); + } + +} diff --git a/lib/private/Log/Rotate.php b/lib/private/Log/Rotate.php index c7103b46075..a5fc7d5a0cd 100644 --- a/lib/private/Log/Rotate.php +++ b/lib/private/Log/Rotate.php @@ -24,6 +24,7 @@ */ namespace OC\Log; + use OCP\Log\RotationTrait; /** diff --git a/lib/private/Mail/Mailer.php b/lib/private/Mail/Mailer.php index f8af68faad3..c07556b6a62 100644 --- a/lib/private/Mail/Mailer.php +++ b/lib/private/Mail/Mailer.php @@ -47,7 +47,6 @@ use OCP\Mail\IMailer; use OCP\Mail\IMessage; use OCP\Mail\Events\BeforeMessageSent; - /** * Class Mailer provides some basic functions to create a mail message that can be used in combination with * \OC\Mail\Message. diff --git a/lib/private/Migration/ConsoleOutput.php b/lib/private/Migration/ConsoleOutput.php index 2efe898a01e..2ad42843dba 100644 --- a/lib/private/Migration/ConsoleOutput.php +++ b/lib/private/Migration/ConsoleOutput.php @@ -22,7 +22,6 @@ namespace OC\Migration; - use OCP\Migration\IOutput; use Symfony\Component\Console\Helper\ProgressBar; use Symfony\Component\Console\Output\OutputInterface; diff --git a/lib/private/Migration/SimpleOutput.php b/lib/private/Migration/SimpleOutput.php index 7f44db9e30a..11f2ed2837c 100644 --- a/lib/private/Migration/SimpleOutput.php +++ b/lib/private/Migration/SimpleOutput.php @@ -22,7 +22,6 @@ namespace OC\Migration; - use OCP\ILogger; use OCP\Migration\IOutput; diff --git a/lib/private/NavigationManager.php b/lib/private/NavigationManager.php index 310201e812d..8d72040af9a 100644 --- a/lib/private/NavigationManager.php +++ b/lib/private/NavigationManager.php @@ -120,7 +120,7 @@ class NavigationManager implements INavigationManager { $result = $this->entries; if ($type !== 'all') { - $result = array_filter($this->entries, function($entry) use ($type) { + $result = array_filter($this->entries, function ($entry) use ($type) { return $entry['type'] === $type; }); } @@ -135,7 +135,7 @@ class NavigationManager implements INavigationManager { * @return array */ private function proceedNavigation(array $list): array { - uasort($list, function($a, $b) { + uasort($list, function ($a, $b) { if (isset($a['order']) && isset($b['order'])) { return ($a['order'] < $b['order']) ? -1 : 1; } else if (isset($a['order']) || isset($b['order'])) { diff --git a/lib/private/Notification/Action.php b/lib/private/Notification/Action.php index 93029bcd7ac..a04f622c3cb 100644 --- a/lib/private/Notification/Action.php +++ b/lib/private/Notification/Action.php @@ -25,7 +25,6 @@ declare(strict_types=1); namespace OC\Notification; - use OCP\Notification\IAction; class Action implements IAction { diff --git a/lib/private/Notification/Manager.php b/lib/private/Notification/Manager.php index b8b549663b1..3a19b0f49e6 100644 --- a/lib/private/Notification/Manager.php +++ b/lib/private/Notification/Manager.php @@ -27,7 +27,6 @@ declare(strict_types=1); namespace OC\Notification; - use OCP\AppFramework\QueryException; use OCP\ILogger; use OCP\Notification\AlreadyProcessedException; diff --git a/lib/private/Notification/Notification.php b/lib/private/Notification/Notification.php index 3e3a15a4f8a..8ac4e19b7d1 100644 --- a/lib/private/Notification/Notification.php +++ b/lib/private/Notification/Notification.php @@ -27,7 +27,6 @@ declare(strict_types=1); namespace OC\Notification; - use OCP\Notification\IAction; use OCP\Notification\INotification; use OCP\RichObjectStrings\InvalidObjectExeption; diff --git a/lib/private/Preview/Bundled.php b/lib/private/Preview/Bundled.php new file mode 100644 index 00000000000..afd286d895b --- /dev/null +++ b/lib/private/Preview/Bundled.php @@ -0,0 +1,56 @@ +<?php +/** + * @copyright Copyright (c) 2020 Julius Härtl <jus@bitgrid.net> + * + * @author Julius Härtl <jus@bitgrid.net> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program 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 program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OC\Preview; + +use OC\Archive\ZIP; +use OCP\Files\File; +use OCP\IImage; + +/** + * Extracts a preview from files that embed them in an ZIP archive + */ +abstract class Bundled extends ProviderV2 { + + protected function extractThumbnail(File $file, $path): ?IImage { + $sourceTmp = \OC::$server->getTempManager()->getTemporaryFile(); + $targetTmp = \OC::$server->getTempManager()->getTemporaryFile(); + + try { + $content = $file->fopen('r'); + file_put_contents($sourceTmp, $content); + + $zip = new ZIP($sourceTmp); + $zip->extractFile($path, $targetTmp); + + $image = new \OC_Image(); + $image->loadFromFile($targetTmp); + $image->fixOrientation(); + + return $image; + } catch (\Exception $e) { + return null; + } + } + +} diff --git a/lib/private/Preview/Generator.php b/lib/private/Preview/Generator.php index bb597460f9d..4ee8518981c 100644 --- a/lib/private/Preview/Generator.php +++ b/lib/private/Preview/Generator.php @@ -330,9 +330,9 @@ class Generator { } /* - * Make sure the requested height and width fall within the max - * of the preview. - */ + * Make sure the requested height and width fall within the max + * of the preview. + */ if ($height > $maxHeight) { $ratio = $height / $maxHeight; $height = $maxHeight; diff --git a/lib/private/Preview/Krita.php b/lib/private/Preview/Krita.php new file mode 100644 index 00000000000..39449145a14 --- /dev/null +++ b/lib/private/Preview/Krita.php @@ -0,0 +1,52 @@ +<?php +/** + * @copyright Copyright (c) 2020 Julius Härtl <jus@bitgrid.net> + * + * @author Julius Härtl <jus@bitgrid.net> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program 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 program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OC\Preview; + +use OCP\Files\File; +use OCP\IImage; + +class Krita extends Bundled { + /** + * {@inheritDoc} + */ + public function getMimeType(): string { + return '/application\/x-krita/'; + } + + + /** + * @inheritDoc + */ + public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage { + $image = $this->extractThumbnail($file, 'mergedimage.png'); + if ($image->valid()) { + return $image; + } + $image = $this->extractThumbnail($file, 'preview.png'); + if ($image->valid()) { + return $image; + } + return null; + } +} diff --git a/lib/private/Preview/OpenDocument.php b/lib/private/Preview/OpenDocument.php index b795441d837..1db7b0be521 100644 --- a/lib/private/Preview/OpenDocument.php +++ b/lib/private/Preview/OpenDocument.php @@ -25,11 +25,26 @@ namespace OC\Preview; //.odt, .ott, .oth, .odm, .odg, .otg, .odp, .otp, .ods, .ots, .odc, .odf, .odb, .odi, .oxt -class OpenDocument extends Office { +use OCP\Files\File; +use OCP\IImage; + +class OpenDocument extends Bundled { /** * {@inheritDoc} */ public function getMimeType(): string { return '/application\/vnd.oasis.opendocument.*/'; } + + + /** + * @inheritDoc + */ + public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage { + $image = $this->extractThumbnail($file, 'Thumbnails/thumbnail.png'); + if ($image->valid()) { + return $image; + } + return null; + } } diff --git a/lib/private/PreviewManager.php b/lib/private/PreviewManager.php index 652a442deec..adfc04199e3 100644 --- a/lib/private/PreviewManager.php +++ b/lib/private/PreviewManager.php @@ -293,13 +293,15 @@ class PreviewManager implements IPreview { Preview\GIF::class, Preview\BMP::class, Preview\HEIC::class, - Preview\XBitmap::class + Preview\XBitmap::class, + Preview\Krita::class, ]; $this->defaultProviders = $this->config->getSystemValue('enabledPreviewProviders', array_merge([ Preview\MarkDown::class, Preview\MP3::class, Preview\TXT::class, + Preview\OpenDocument::class, ], $imageProviders)); if (in_array(Preview\Image::class, $this->defaultProviders)) { @@ -339,7 +341,9 @@ class PreviewManager implements IPreview { $this->registerCoreProvider(Preview\GIF::class, '/image\/gif/'); $this->registerCoreProvider(Preview\BMP::class, '/image\/bmp/'); $this->registerCoreProvider(Preview\XBitmap::class, '/image\/x-xbitmap/'); + $this->registerCoreProvider(Preview\Krita::class, '/application\/x-krita/'); $this->registerCoreProvider(Preview\MP3::class, '/audio\/mpeg/'); + $this->registerCoreProvider(Preview\OpenDocument::class, '/application\/vnd.oasis.opendocument.*/'); // SVG, Office and Bitmap require imagick if (extension_loaded('imagick')) { diff --git a/lib/private/Remote/Api/ApiCollection.php b/lib/private/Remote/Api/ApiCollection.php index c1f2a732a8e..9ce4c7d0661 100644 --- a/lib/private/Remote/Api/ApiCollection.php +++ b/lib/private/Remote/Api/ApiCollection.php @@ -23,7 +23,6 @@ namespace OC\Remote\Api; - use OCP\Http\Client\IClientService; use OCP\Remote\Api\IApiCollection; use OCP\Remote\ICredentials; diff --git a/lib/private/Remote/Api/ApiFactory.php b/lib/private/Remote/Api/ApiFactory.php index 62f20e2787c..81bc41f9269 100644 --- a/lib/private/Remote/Api/ApiFactory.php +++ b/lib/private/Remote/Api/ApiFactory.php @@ -23,7 +23,6 @@ namespace OC\Remote\Api; - use OCP\Http\Client\IClientService; use OCP\Remote\Api\IApiFactory; use OCP\Remote\ICredentials; diff --git a/lib/private/Remote/Api/NotFoundException.php b/lib/private/Remote/Api/NotFoundException.php index 429d3e87a10..51ecfabd402 100644 --- a/lib/private/Remote/Api/NotFoundException.php +++ b/lib/private/Remote/Api/NotFoundException.php @@ -23,7 +23,6 @@ namespace OC\Remote\Api; - class NotFoundException extends \Exception { } diff --git a/lib/private/Remote/Api/OCS.php b/lib/private/Remote/Api/OCS.php index 553ac92df7a..6a32c83e086 100644 --- a/lib/private/Remote/Api/OCS.php +++ b/lib/private/Remote/Api/OCS.php @@ -23,7 +23,6 @@ namespace OC\Remote\Api; - use GuzzleHttp\Exception\ClientException; use OC\ForbiddenException; use OC\Remote\User; diff --git a/lib/private/Remote/Credentials.php b/lib/private/Remote/Credentials.php index 5a4654436b8..09f5e1cda78 100644 --- a/lib/private/Remote/Credentials.php +++ b/lib/private/Remote/Credentials.php @@ -23,7 +23,6 @@ namespace OC\Remote; - use OCP\Remote\ICredentials; class Credentials implements ICredentials { diff --git a/lib/private/Remote/InstanceFactory.php b/lib/private/Remote/InstanceFactory.php index 9d42353e792..a4445a8306b 100644 --- a/lib/private/Remote/InstanceFactory.php +++ b/lib/private/Remote/InstanceFactory.php @@ -23,7 +23,6 @@ namespace OC\Remote; - use OCP\Http\Client\IClientService; use OCP\ICache; use OCP\Remote\IInstanceFactory; diff --git a/lib/private/Remote/User.php b/lib/private/Remote/User.php index ef26171859a..5519d7dc22f 100644 --- a/lib/private/Remote/User.php +++ b/lib/private/Remote/User.php @@ -23,7 +23,6 @@ namespace OC\Remote; - use OCP\Remote\IUser; class User implements IUser { diff --git a/lib/private/RichObjectStrings/Validator.php b/lib/private/RichObjectStrings/Validator.php index 0a651256d3a..c80da2914a4 100644 --- a/lib/private/RichObjectStrings/Validator.php +++ b/lib/private/RichObjectStrings/Validator.php @@ -25,7 +25,6 @@ namespace OC\RichObjectStrings; - use OCP\RichObjectStrings\Definitions; use OCP\RichObjectStrings\InvalidObjectExeption; use OCP\RichObjectStrings\IValidator; diff --git a/lib/private/Route/Route.php b/lib/private/Route/Route.php index 60b14efc7d6..705183d24ae 100644 --- a/lib/private/Route/Route.php +++ b/lib/private/Route/Route.php @@ -149,7 +149,7 @@ class Route extends SymfonyRoute implements IRoute { * @return void */ public function actionInclude($file) { - $function = function($param) use ($file) { + $function = function ($param) use ($file) { unset($param["_route"]); $_GET=array_merge($_GET, $param); unset($param); diff --git a/lib/private/Search.php b/lib/private/Search.php index ca9024bdd78..42a925f90d9 100644 --- a/lib/private/Search.php +++ b/lib/private/Search.php @@ -27,6 +27,7 @@ */ namespace OC; + use OCP\ISearch; use OCP\Search\PagedProvider; use OCP\Search\Provider; @@ -52,7 +53,7 @@ class Search implements ISearch { $results = []; foreach($this->providers as $provider) { /** @var $provider Provider */ - if ( ! $provider->providesResultsFor($inApps) ) { + if (! $provider->providesResultsFor($inApps)) { continue; } if ($provider instanceof PagedProvider) { @@ -108,7 +109,7 @@ class Search implements ISearch { * Create instances of all the registered search providers */ private function initProviders() { - if( ! empty($this->providers) ) { + if(! empty($this->providers)) { return; } foreach($this->registeredProviders as $provider) { diff --git a/lib/private/Search/Provider/File.php b/lib/private/Search/Provider/File.php index afd37cfe703..734878be982 100644 --- a/lib/private/Search/Provider/File.php +++ b/lib/private/Search/Provider/File.php @@ -27,6 +27,7 @@ */ namespace OC\Search\Provider; + use OC\Files\Filesystem; /** diff --git a/lib/private/Search/Result/Audio.php b/lib/private/Search/Result/Audio.php index a035f51b38b..67a6add04bf 100644 --- a/lib/private/Search/Result/Audio.php +++ b/lib/private/Search/Result/Audio.php @@ -31,7 +31,7 @@ class Audio extends File { /** * Type name; translated in templates - * @var string + * @var string */ public $type = 'audio'; diff --git a/lib/private/Search/Result/File.php b/lib/private/Search/Result/File.php index 09d2afb2617..cd605c49821 100644 --- a/lib/private/Search/Result/File.php +++ b/lib/private/Search/Result/File.php @@ -24,6 +24,7 @@ */ namespace OC\Search\Result; + use OCP\Files\FileInfo; use OCP\Files\Folder; @@ -34,7 +35,7 @@ class File extends \OCP\Search\Result { /** * Type name; translated in templates - * @var string + * @var string */ public $type = 'file'; @@ -46,7 +47,7 @@ class File extends \OCP\Search\Result { /** * Size, in bytes - * @var int + * @var int */ public $size; @@ -64,7 +65,7 @@ class File extends \OCP\Search\Result { /** * File permissions: - * + * * @var string */ public $permissions; @@ -105,7 +106,7 @@ class File extends \OCP\Search\Result { * @param string $path * @return string relative path */ - protected function getRelativePath ($path) { + protected function getRelativePath($path) { if (!isset(self::$userFolderCache)) { $user = \OC::$server->getUserSession()->getUser()->getUID(); self::$userFolderCache = \OC::$server->getUserFolder($user); diff --git a/lib/private/Search/Result/Folder.php b/lib/private/Search/Result/Folder.php index 1626f9d67d2..0a746221ee0 100644 --- a/lib/private/Search/Result/Folder.php +++ b/lib/private/Search/Result/Folder.php @@ -31,7 +31,7 @@ class Folder extends File { /** * Type name; translated in templates - * @var string + * @var string */ public $type = 'folder'; diff --git a/lib/private/Search/Result/Image.php b/lib/private/Search/Result/Image.php index 02973855efb..21123a4de13 100644 --- a/lib/private/Search/Result/Image.php +++ b/lib/private/Search/Result/Image.php @@ -31,7 +31,7 @@ class Image extends File { /** * Type name; translated in templates - * @var string + * @var string */ public $type = 'image'; diff --git a/lib/private/Security/Bruteforce/Throttler.php b/lib/private/Security/Bruteforce/Throttler.php index b5a4dfbfaff..8e58e9bde9a 100644 --- a/lib/private/Security/Bruteforce/Throttler.php +++ b/lib/private/Security/Bruteforce/Throttler.php @@ -144,7 +144,7 @@ class Throttler { } $keys = $this->config->getAppKeys('bruteForce'); - $keys = array_filter($keys, function($key) { + $keys = array_filter($keys, function ($key) { $regex = '/^whitelist_/S'; return preg_match($regex, $key) === 1; }); diff --git a/lib/private/Security/TrustedDomainHelper.php b/lib/private/Security/TrustedDomainHelper.php index 473e56cdd51..c1789da6ad7 100644 --- a/lib/private/Security/TrustedDomainHelper.php +++ b/lib/private/Security/TrustedDomainHelper.php @@ -26,6 +26,7 @@ */ namespace OC\Security; + use OC\AppFramework\Http\Request; use OCP\IConfig; @@ -97,11 +98,11 @@ class TrustedDomainHelper { if (gettype($trusted) !== 'string') { break; } - $regex = '/^' . implode('[-\.a-zA-Z0-9]*', array_map(function($v) { return preg_quote($v, '/'); }, explode('*', $trusted))) . '$/i'; + $regex = '/^' . implode('[-\.a-zA-Z0-9]*', array_map(function ($v) { return preg_quote($v, '/'); }, explode('*', $trusted))) . '$/i'; if (preg_match($regex, $domain) || preg_match($regex, $domainWithPort)) { - return true; - } - } - return false; + return true; + } + } + return false; } } diff --git a/lib/private/Server.php b/lib/private/Server.php index c7a30e3c9f8..026dcdf9a85 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -104,6 +104,7 @@ use OC\Lock\MemcacheLockingProvider; use OC\Lock\NoopLockingProvider; use OC\Lockdown\LockdownManager; use OC\Log\LogFactory; +use OC\Log\PsrLoggerAdapter; use OC\Mail\Mailer; use OC\Memcache\ArrayCache; use OC\Memcache\Factory; @@ -225,6 +226,7 @@ use OCP\User\Events\UserDeletedEvent; use OCP\User\Events\UserLoggedInEvent; use OCP\User\Events\UserLoggedInWithCookieEvent; use OCP\User\Events\UserLoggedOutEvent; +use Psr\Log\LoggerInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\GenericEvent; use OCA\Files_External\Service\UserStoragesService; @@ -698,7 +700,7 @@ class Server extends ServerContainer implements IServerContainer { }); $this->registerAlias(IValidator::class, Validator::class); - $this->registerService(AvatarManager::class, function(Server $c) { + $this->registerService(AvatarManager::class, function (Server $c) { return new AvatarManager( $c->query(\OC\User\Manager::class), $c->getAppDataDir('avatar'), @@ -723,6 +725,8 @@ class Server extends ServerContainer implements IServerContainer { }); $this->registerAlias(ILogger::class, \OC\Log::class); $this->registerDeprecatedAlias('Logger', \OC\Log::class); + // PSR-3 logger + $this->registerAlias(LoggerInterface::class, PsrLoggerAdapter::class); $this->registerService(ILogFactory::class, function (Server $c) { return new LogFactory($c, $this->getSystemConfig()); @@ -1081,7 +1085,7 @@ class Server extends ServerContainer implements IServerContainer { $factory = new $factoryClass($this); $manager = $factory->getManager(); - $manager->registerDisplayNameResolver('user', function($id) use ($c) { + $manager->registerDisplayNameResolver('user', function ($id) use ($c) { $manager = $c->getUserManager(); $user = $manager->get($id); if(is_null($user)) { @@ -1227,7 +1231,7 @@ class Server extends ServerContainer implements IServerContainer { }); $this->registerDeprecatedAlias('ShareManager', \OCP\Share\IManager::class); - $this->registerService(\OCP\Collaboration\Collaborators\ISearch::class, function(Server $c) { + $this->registerService(\OCP\Collaboration\Collaborators\ISearch::class, function (Server $c) { $instance = new Collaboration\Collaborators\Search($c); // register default plugins @@ -1312,7 +1316,7 @@ class Server extends ServerContainer implements IServerContainer { ); }); - $this->registerService(Installer::class, function(Server $c) { + $this->registerService(Installer::class, function (Server $c) { return new Installer( $c->getAppFetcher(), $c->getHTTPClientService(), @@ -1323,16 +1327,16 @@ class Server extends ServerContainer implements IServerContainer { ); }); - $this->registerService(IApiFactory::class, function(Server $c) { + $this->registerService(IApiFactory::class, function (Server $c) { return new ApiFactory($c->getHTTPClientService()); }); - $this->registerService(IInstanceFactory::class, function(Server $c) { + $this->registerService(IInstanceFactory::class, function (Server $c) { $memcacheFactory = $c->getMemCacheFactory(); return new InstanceFactory($memcacheFactory->createLocal('remoteinstance.'), $c->getHTTPClientService()); }); - $this->registerService(IContactsStore::class, function(Server $c) { + $this->registerService(IContactsStore::class, function (Server $c) { return new ContactsStore( $c->getContactsManager(), $c->getConfig(), @@ -1343,7 +1347,7 @@ class Server extends ServerContainer implements IServerContainer { $this->registerAlias(IContactsStore::class, ContactsStore::class); $this->registerAlias(IAccountManager::class, AccountManager::class); - $this->registerService(IStorageFactory::class, function() { + $this->registerService(IStorageFactory::class, function () { return new StorageFactory(); }); @@ -1382,7 +1386,7 @@ class Server extends ServerContainer implements IServerContainer { $dispatcher = $this->getEventDispatcher(); // Delete avatar on user deletion - $dispatcher->addListener('OCP\IUser::preDelete', function(GenericEvent $e) { + $dispatcher->addListener('OCP\IUser::preDelete', function (GenericEvent $e) { $logger = $this->getLogger(); $manager = $this->getAvatarManager(); /** @var IUser $user */ @@ -2137,7 +2141,7 @@ class Server extends ServerContainer implements IServerContainer { /** * @return \OCP\Collaboration\AutoComplete\IManager */ - public function getAutoCompleteManager(){ + public function getAutoCompleteManager() { return $this->query(IManager::class); } diff --git a/lib/private/ServerContainer.php b/lib/private/ServerContainer.php index 8f2f2a93503..13fb70ddd44 100644 --- a/lib/private/ServerContainer.php +++ b/lib/private/ServerContainer.php @@ -27,7 +27,6 @@ declare(strict_types=1); namespace OC; - use OC\AppFramework\App; use OC\AppFramework\DependencyInjection\DIContainer; use OC\AppFramework\Utility\SimpleContainer; diff --git a/lib/private/ServerNotAvailableException.php b/lib/private/ServerNotAvailableException.php index a78d470e2a6..1dd93aefb20 100644 --- a/lib/private/ServerNotAvailableException.php +++ b/lib/private/ServerNotAvailableException.php @@ -22,7 +22,6 @@ namespace OC; - class ServerNotAvailableException extends \Exception { } diff --git a/lib/private/Session/CryptoSessionData.php b/lib/private/Session/CryptoSessionData.php index a0178c7eea2..da9bf950ba2 100644 --- a/lib/private/Session/CryptoSessionData.php +++ b/lib/private/Session/CryptoSessionData.php @@ -50,7 +50,7 @@ class CryptoSessionData implements \ArrayAccess, ISession { protected $sessionValues; /** @var bool */ protected $isModified = false; - CONST encryptedSessionName = 'encrypted_session_data'; + const encryptedSessionName = 'encrypted_session_data'; /** * @param ISession $session diff --git a/lib/private/Settings/Manager.php b/lib/private/Settings/Manager.php index 81b29020287..ac4f8f9342c 100644 --- a/lib/private/Settings/Manager.php +++ b/lib/private/Settings/Manager.php @@ -230,7 +230,7 @@ class Manager implements IManager { */ public function getAdminSettings($section, bool $subAdminOnly = false): array { if ($subAdminOnly) { - $subAdminSettingsFilter = function(ISettings $settings) { + $subAdminSettingsFilter = function (ISettings $settings) { return $settings instanceof ISubAdminSettings; }; $appSettings = $this->getSettings('admin', $section, $subAdminSettingsFilter); diff --git a/lib/private/Share/Share.php b/lib/private/Share/Share.php index 2bc2afbea2e..9b74239d69d 100644 --- a/lib/private/Share/Share.php +++ b/lib/private/Share/Share.php @@ -854,7 +854,7 @@ class Share extends Constants { } // Add display names to result $row['share_with_displayname'] = $row['share_with']; - if ( isset($row['share_with']) && $row['share_with'] != '' && + if (isset($row['share_with']) && $row['share_with'] != '' && $row['share_type'] === self::SHARE_TYPE_USER) { $shareWithUser = \OC::$server->getUserManager()->get($row['share_with']); $row['share_with_displayname'] = $shareWithUser === null ? $row['share_with'] : $shareWithUser->getDisplayName(); @@ -869,7 +869,7 @@ class Share extends Constants { } } } - if ( isset($row['uid_owner']) && $row['uid_owner'] != '') { + if (isset($row['uid_owner']) && $row['uid_owner'] != '') { $ownerUser = \OC::$server->getUserManager()->get($row['uid_owner']); $row['displayname_owner'] = $ownerUser === null ? $row['uid_owner'] : $ownerUser->getDisplayName(); } @@ -975,7 +975,7 @@ class Share extends Constants { // filter out invalid items, these can appear when subshare entries exist // for a group in which the requested user isn't a member any more - $items = array_filter($items, function($item) { + $items = array_filter($items, function ($item) { return $item['share_type'] !== self::$shareTypeGroupUserUnique; }); @@ -1018,7 +1018,7 @@ class Share extends Constants { // for file/folder shares we need to compare file_source, otherwise we compare item_source // only group shares if they already point to the same target, otherwise the file where shared // before grouping of shares was added. In this case we don't group them toi avoid confusions - if (( $fileSharing && $item['file_source'] === $r['file_source'] && $item['file_target'] === $r['file_target']) || + if (($fileSharing && $item['file_source'] === $r['file_source'] && $item['file_target'] === $r['file_target']) || (!$fileSharing && $item['item_source'] === $r['item_source'] && $item['item_target'] === $r['item_target'])) { // add the first item to the list of grouped shares if (!isset($result[$key]['grouped'])) { @@ -1359,7 +1359,7 @@ class Share extends Constants { $select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `item_target`,' . '`*PREFIX*share`.`parent`, `share_type`, `share_with`, `uid_owner`,' . '`file_source`, `path`, `file_target`, `*PREFIX*share`.`permissions`,' - . '`stime`, `expiration`, `token`, `storage`, `mail_send`,' + . '`stime`, `expiration`, `token`, `storage`, `mail_send`,' . '`*PREFIX*storages`.`id` AS `storage_id`, `*PREFIX*filecache`.`parent` as `file_parent`'; } } diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index 065d06de37e..1c0ec194528 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -838,7 +838,7 @@ class DefaultShareProvider implements IShareProvider { $pathSections = explode('/', $data['path'], 2); // FIXME: would not detect rare md5'd home storage case properly if ($pathSections[0] !== 'files' - && in_array(explode(':', $data['storage_string_id'], 2)[0], ['home', 'object'])) { + && in_array(explode(':', $data['storage_string_id'], 2)[0], ['home', 'object'])) { return false; } return true; @@ -933,8 +933,8 @@ class DefaultShareProvider implements IShareProvider { } - $groups = array_filter($groups, function($group) { return $group instanceof IGroup; }); - $groups = array_map(function(IGroup $group) { return $group->getGID(); }, $groups); + $groups = array_filter($groups, function ($group) { return $group instanceof IGroup; }); + $groups = array_map(function (IGroup $group) { return $group->getGID(); }, $groups); $qb->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_GROUP))) ->andWhere($qb->expr()->in('share_with', $qb->createNamedParameter( @@ -961,8 +961,8 @@ class DefaultShareProvider implements IShareProvider { } /* - * Resolve all group shares to user specific shares - */ + * Resolve all group shares to user specific shares + */ $shares = $this->resolveGroupShares($shares2, $userId); } else { throw new BackendError('Invalid backend'); diff --git a/lib/private/Share20/Exception/ProviderException.php b/lib/private/Share20/Exception/ProviderException.php index 360f42f63f0..7d3f79f7120 100644 --- a/lib/private/Share20/Exception/ProviderException.php +++ b/lib/private/Share20/Exception/ProviderException.php @@ -22,7 +22,6 @@ namespace OC\Share20\Exception; - class ProviderException extends \Exception { } diff --git a/lib/private/Share20/LegacyHooks.php b/lib/private/Share20/LegacyHooks.php index 5cfc1cc27e3..f292499584e 100644 --- a/lib/private/Share20/LegacyHooks.php +++ b/lib/private/Share20/LegacyHooks.php @@ -75,7 +75,7 @@ class LegacyHooks { /** @var IShare[] $deletedShares */ $deletedShares = $e->getArgument('deletedShares'); - $formattedDeletedShares = array_map(function($share) { + $formattedDeletedShares = array_map(function ($share) { return $this->formatHookParams($share); }, $deletedShares); diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 4e1f6567e6b..c56db22c883 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -932,7 +932,7 @@ class Manager implements IManager { // We can only change the recipient on user shares if ($share->getSharedWith() !== $originalShare->getSharedWith() && - $share->getShareType() !== \OCP\Share::SHARE_TYPE_USER) { + $share->getShareType() !== \OCP\Share::SHARE_TYPE_USER) { throw new \InvalidArgumentException('Can only update recipient on user shares'); } @@ -1200,7 +1200,7 @@ class Manager implements IManager { public function getSharesInFolder($userId, Folder $node, $reshares = false) { $providers = $this->factory->getAllProviders(); - return array_reduce($providers, function($shares, IShareProvider $provider) use ($userId, $node, $reshares) { + return array_reduce($providers, function ($shares, IShareProvider $provider) use ($userId, $node, $reshares) { $newShares = $provider->getSharesInFolder($userId, $node, $reshares); foreach ($newShares as $fid => $data) { if (!isset($shares[$fid])) { @@ -1318,7 +1318,7 @@ class Manager implements IManager { $shares = $this->getSharedWith($userId, $shareType, $node, $limit, $offset); // Only get deleted shares - $shares = array_filter($shares, function(IShare $share) { + $shares = array_filter($shares, function (IShare $share) { return $share->getPermissions() === 0; }); diff --git a/lib/private/Streamer.php b/lib/private/Streamer.php index 939bb4ea5d8..47348447e6d 100644 --- a/lib/private/Streamer.php +++ b/lib/private/Streamer.php @@ -52,7 +52,7 @@ class Streamer { * @param int $numberOfFiles The number of files (and directories) that will * be included in the streamed file */ - public function __construct(IRequest $request, int $size, int $numberOfFiles){ + public function __construct(IRequest $request, int $size, int $numberOfFiles) { /** * zip32 constraints for a basic (without compression, volumes nor @@ -89,7 +89,7 @@ class Streamer { * Send HTTP headers * @param string $name */ - public function sendHeaders($name){ + public function sendHeaders($name) { $extension = $this->streamerInstance instanceof ZipStreamer ? '.zip' : '.tar'; $fullName = $name . $extension; $this->streamerInstance->sendHeaders($fullName); @@ -169,7 +169,7 @@ class Streamer { * @param string $dirName Directory Path and name to be added to the archive. * @return bool $success */ - public function addEmptyDir($dirName){ + public function addEmptyDir($dirName) { return $this->streamerInstance->addEmptyDir($dirName); } @@ -179,7 +179,7 @@ class Streamer { * closing, the file is completely written to the output stream. * @return bool $success */ - public function finalize(){ + public function finalize() { return $this->streamerInstance->finalize(); } } diff --git a/lib/private/SubAdmin.php b/lib/private/SubAdmin.php index ce2a38ccbf6..8a8cbdb9813 100644 --- a/lib/private/SubAdmin.php +++ b/lib/private/SubAdmin.php @@ -54,16 +54,16 @@ class SubAdmin extends PublicEmitter implements ISubAdmin { * @param IDBConnection $dbConn */ public function __construct(IUserManager $userManager, - IGroupManager $groupManager, + IGroupManager $groupManager, IDBConnection $dbConn) { $this->userManager = $userManager; $this->groupManager = $groupManager; $this->dbConn = $dbConn; - $this->userManager->listen('\OC\User', 'postDelete', function($user) { + $this->userManager->listen('\OC\User', 'postDelete', function ($user) { $this->post_deleteUser($user); }); - $this->groupManager->listen('\OC\Group', 'postDelete', function($group) { + $this->groupManager->listen('\OC\Group', 'postDelete', function ($group) { $this->post_deleteGroup($group); }); } @@ -135,7 +135,7 @@ class SubAdmin extends PublicEmitter implements ISubAdmin { * @return array ['displayName' => displayname] */ public function getSubAdminsGroupsName(IUser $user): array { - return array_map(function($group) { + return array_map(function ($group) { return ['displayName' => $group->getDisplayName()]; }, $this->getSubAdminsGroups($user)); } diff --git a/lib/private/SystemConfig.php b/lib/private/SystemConfig.php index 321ec61e048..7f0114ec821 100644 --- a/lib/private/SystemConfig.php +++ b/lib/private/SystemConfig.php @@ -27,7 +27,6 @@ namespace OC; - use OCP\IConfig; /** diff --git a/lib/private/SystemTag/SystemTagObjectMapper.php b/lib/private/SystemTag/SystemTagObjectMapper.php index f73bb3f5f12..179e16f8e17 100644 --- a/lib/private/SystemTag/SystemTagObjectMapper.php +++ b/lib/private/SystemTag/SystemTagObjectMapper.php @@ -51,12 +51,12 @@ class SystemTagObjectMapper implements ISystemTagObjectMapper { protected $dispatcher; /** - * Constructor. - * - * @param IDBConnection $connection database connection - * @param ISystemTagManager $tagManager system tag manager - * @param EventDispatcherInterface $dispatcher - */ + * Constructor. + * + * @param IDBConnection $connection database connection + * @param ISystemTagManager $tagManager system tag manager + * @param EventDispatcherInterface $dispatcher + */ public function __construct(IDBConnection $connection, ISystemTagManager $tagManager, EventDispatcherInterface $dispatcher) { $this->connection = $connection; $this->tagManager = $tagManager; @@ -259,7 +259,7 @@ class SystemTagObjectMapper implements ISystemTagObjectMapper { if (\count($tags) !== \count($tagIds)) { // at least one tag missing, bail out $foundTagIds = array_map( - function(ISystemTag $tag) { + function (ISystemTag $tag) { return $tag->getId(); }, $tags diff --git a/lib/private/TagManager.php b/lib/private/TagManager.php index ccb2e796155..52d000f8c94 100644 --- a/lib/private/TagManager.php +++ b/lib/private/TagManager.php @@ -56,11 +56,11 @@ class TagManager implements \OCP\ITagManager { private $mapper; /** - * Constructor. - * - * @param TagMapper $mapper Instance of the TagMapper abstraction layer. - * @param \OCP\IUserSession $userSession the user session - */ + * Constructor. + * + * @param TagMapper $mapper Instance of the TagMapper abstraction layer. + * @param \OCP\IUserSession $userSession the user session + */ public function __construct(TagMapper $mapper, \OCP\IUserSession $userSession) { $this->mapper = $mapper; $this->userSession = $userSession; @@ -68,16 +68,16 @@ class TagManager implements \OCP\ITagManager { } /** - * Create a new \OCP\ITags instance and load tags from db. - * - * @see \OCP\ITags - * @param string $type The type identifier e.g. 'contact' or 'event'. - * @param array $defaultTags An array of default tags to be used if none are stored. - * @param boolean $includeShared Whether to include tags for items shared with this user by others. - * @param string $userId user for which to retrieve the tags, defaults to the currently - * logged in user - * @return \OCP\ITags - */ + * Create a new \OCP\ITags instance and load tags from db. + * + * @see \OCP\ITags + * @param string $type The type identifier e.g. 'contact' or 'event'. + * @param array $defaultTags An array of default tags to be used if none are stored. + * @param boolean $includeShared Whether to include tags for items shared with this user by others. + * @param string $userId user for which to retrieve the tags, defaults to the currently + * logged in user + * @return \OCP\ITags + */ public function load($type, $defaultTags = [], $includeShared = false, $userId = null) { if (is_null($userId)) { $user = $this->userSession->getUser(); diff --git a/lib/private/Tagging/Tag.php b/lib/private/Tagging/Tag.php index eacb272ca7a..f818a115b25 100644 --- a/lib/private/Tagging/Tag.php +++ b/lib/private/Tagging/Tag.php @@ -43,12 +43,12 @@ class Tag extends Entity { protected $name; /** - * Constructor. - * - * @param string $owner The tag's owner - * @param string $type The type of item this tag is used for - * @param string $name The tag's name - */ + * Constructor. + * + * @param string $owner The tag's owner + * @param string $type The type of item this tag is used for + * @param string $name The tag's name + */ public function __construct($owner = null, $type = null, $name = null) { $this->setOwner($owner); $this->setType($type); @@ -63,13 +63,13 @@ class Tag extends Entity { * @todo migrate existing database columns to the correct names * to be able to drop this direct mapping */ - public function columnToProperty($columnName){ + public function columnToProperty($columnName) { if ($columnName === 'category') { - return 'name'; + return 'name'; } elseif ($columnName === 'uid') { - return 'owner'; + return 'owner'; } else { - return parent::columnToProperty($columnName); + return parent::columnToProperty($columnName); } } @@ -79,13 +79,13 @@ class Tag extends Entity { * @param string $property the name of the property * @return string the column name */ - public function propertyToColumn($property){ + public function propertyToColumn($property) { if ($property === 'name') { - return 'category'; + return 'category'; } elseif ($property === 'owner') { - return 'uid'; + return 'uid'; } else { - return parent::propertyToColumn($property); + return parent::propertyToColumn($property); } } } diff --git a/lib/private/Tagging/TagMapper.php b/lib/private/Tagging/TagMapper.php index c021c3646a4..2ffb663aeff 100644 --- a/lib/private/Tagging/TagMapper.php +++ b/lib/private/Tagging/TagMapper.php @@ -36,21 +36,21 @@ use OCP\IDBConnection; class TagMapper extends Mapper { /** - * Constructor. - * - * @param IDBConnection $db Instance of the Db abstraction layer. - */ + * Constructor. + * + * @param IDBConnection $db Instance of the Db abstraction layer. + */ public function __construct(IDBConnection $db) { parent::__construct($db, 'vcategory', Tag::class); } /** - * Load tags from the database. - * - * @param array|string $owners The user(s) whose tags we are going to load. - * @param string $type The type of item for which we are loading tags. - * @return array An array of Tag objects. - */ + * Load tags from the database. + * + * @param array|string $owners The user(s) whose tags we are going to load. + * @param string $type The type of item for which we are loading tags. + * @return array An array of Tag objects. + */ public function loadTags($owners, $type) { if(!is_array($owners)) { $owners = [$owners]; @@ -62,11 +62,11 @@ class TagMapper extends Mapper { } /** - * Check if a given Tag object already exists in the database. - * - * @param Tag $tag The tag to look for in the database. - * @return bool - */ + * Check if a given Tag object already exists in the database. + * + * @param Tag $tag The tag to look for in the database. + * @return bool + */ public function tagExists($tag) { $sql = 'SELECT `id`, `uid`, `type`, `category` FROM `' . $this->getTableName() . '` ' . 'WHERE `uid` = ? AND `type` = ? AND `category` = ?'; diff --git a/lib/private/Tags.php b/lib/private/Tags.php index 8e26cccb408..4d05beb259c 100644 --- a/lib/private/Tags.php +++ b/lib/private/Tags.php @@ -116,14 +116,14 @@ class Tags implements ITags { const RELATION_TABLE = '*PREFIX*vcategory_to_object'; /** - * Constructor. - * - * @param TagMapper $mapper Instance of the TagMapper abstraction layer. - * @param string $user The user whose data the object will operate on. - * @param string $type The type of items for which tags will be loaded. - * @param array $defaultTags Tags that should be created at construction. - * @param boolean $includeShared Whether to include tags for items shared with this user by others. - */ + * Constructor. + * + * @param TagMapper $mapper Instance of the TagMapper abstraction layer. + * @param string $user The user whose data the object will operate on. + * @param string $type The type of items for which tags will be loaded. + * @param array $defaultTags Tags that should be created at construction. + * @param boolean $includeShared Whether to include tags for items shared with this user by others. + */ public function __construct(TagMapper $mapper, $user, $type, $defaultTags = [], $includeShared = false) { $this->mapper = $mapper; $this->user = $user; @@ -142,21 +142,21 @@ class Tags implements ITags { } /** - * Check if any tags are saved for this type and user. - * - * @return boolean - */ + * Check if any tags are saved for this type and user. + * + * @return boolean + */ public function isEmpty() { return count($this->tags) === 0; } /** - * Returns an array mapping a given tag's properties to its values: - * ['id' => 0, 'name' = 'Tag', 'owner' = 'User', 'type' => 'tagtype'] - * - * @param string $id The ID of the tag that is going to be mapped - * @return array|false - */ + * Returns an array mapping a given tag's properties to its values: + * ['id' => 0, 'name' = 'Tag', 'owner' = 'User', 'type' => 'tagtype'] + * + * @param string $id The ID of the tag that is going to be mapped + * @return array|false + */ public function getTag($id) { $key = $this->getTagById($id); if ($key !== false) { @@ -166,22 +166,22 @@ class Tags implements ITags { } /** - * Get the tags for a specific user. - * - * This returns an array with maps containing each tag's properties: - * [ - * ['id' => 0, 'name' = 'First tag', 'owner' = 'User', 'type' => 'tagtype'], - * ['id' => 1, 'name' = 'Shared tag', 'owner' = 'Other user', 'type' => 'tagtype'], - * ] - * - * @return array - */ + * Get the tags for a specific user. + * + * This returns an array with maps containing each tag's properties: + * [ + * ['id' => 0, 'name' = 'First tag', 'owner' = 'User', 'type' => 'tagtype'], + * ['id' => 1, 'name' = 'Shared tag', 'owner' = 'Other user', 'type' => 'tagtype'], + * ] + * + * @return array + */ public function getTags() { if(!count($this->tags)) { return []; } - usort($this->tags, function($a, $b) { + usort($this->tags, function ($a, $b) { return strnatcasecmp($a->getName(), $b->getName()); }); $tagMap = []; @@ -196,15 +196,15 @@ class Tags implements ITags { } /** - * Return only the tags owned by the given user, omitting any tags shared - * by other users. - * - * @param string $user The user whose tags are to be checked. - * @return array An array of Tag objects. - */ + * Return only the tags owned by the given user, omitting any tags shared + * by other users. + * + * @param string $user The user whose tags are to be checked. + * @return array An array of Tag objects. + */ public function getTagsForUser($user) { return array_filter($this->tags, - function($tag) use($user) { + function ($tag) use ($user) { return $tag->getOwner() === $user; } ); @@ -256,14 +256,14 @@ class Tags implements ITags { } /** - * Get the a list if items tagged with $tag. - * - * Throws an exception if the tag could not be found. - * - * @param string $tag Tag id or name. - * @return array|false An array of object ids or false on error. - * @throws \Exception - */ + * Get the a list if items tagged with $tag. + * + * Throws an exception if the tag could not be found. + * + * @param string $tag Tag id or name. + * @return array|false An array of object ids or false on error. + * @throws \Exception + */ public function getIdsForTag($tag) { $result = null; $tagId = false; @@ -306,7 +306,7 @@ class Tags implements ITags { } if(!is_null($result)) { - while( $row = $result->fetchRow()) { + while($row = $result->fetchRow()) { $id = (int)$row['objid']; if ($this->includeShared) { @@ -330,34 +330,34 @@ class Tags implements ITags { } /** - * Checks whether a tag is saved for the given user, - * disregarding the ones shared with him or her. - * - * @param string $name The tag name to check for. - * @param string $user The user whose tags are to be checked. - * @return bool - */ + * Checks whether a tag is saved for the given user, + * disregarding the ones shared with him or her. + * + * @param string $name The tag name to check for. + * @param string $user The user whose tags are to be checked. + * @return bool + */ public function userHasTag($name, $user) { $key = $this->array_searchi($name, $this->getTagsForUser($user)); return ($key !== false) ? $this->tags[$key]->getId() : false; } /** - * Checks whether a tag is saved for or shared with the current user. - * - * @param string $name The tag name to check for. - * @return bool - */ + * Checks whether a tag is saved for or shared with the current user. + * + * @param string $name The tag name to check for. + * @return bool + */ public function hasTag($name) { return $this->getTagId($name) !== false; } /** - * Add a new tag. - * - * @param string $name A string with a name of the tag - * @return false|int the id of the added tag or false on error. - */ + * Add a new tag. + * + * @param string $name A string with a name of the tag + * @return false|int the id of the added tag or false on error. + */ public function add($name) { $name = trim($name); @@ -386,12 +386,12 @@ class Tags implements ITags { } /** - * Rename tag. - * - * @param string|integer $from The name or ID of the existing tag - * @param string $to The new name of the tag. - * @return bool - */ + * Rename tag. + * + * @param string|integer $from The name or ID of the existing tag + * @param string $to The new name of the tag. + * @return bool + */ public function rename($from, $to) { $from = trim($from); $to = trim($to); @@ -432,14 +432,14 @@ class Tags implements ITags { } /** - * Add a list of new tags. - * - * @param string[] $names A string with a name or an array of strings containing - * the name(s) of the tag(s) to add. - * @param bool $sync When true, save the tags - * @param int|null $id int Optional object id to add to this|these tag(s) - * @return bool Returns false on error. - */ + * Add a list of new tags. + * + * @param string[] $names A string with a name or an array of strings containing + * the name(s) of the tag(s) to add. + * @param bool $sync When true, save the tags + * @param int|null $id int Optional object id to add to this|these tag(s) + * @return bool Returns false on error. + */ public function addMultiple($names, $sync=false, $id = null) { if(!is_array($names)) { $names = [$names]; @@ -452,7 +452,7 @@ class Tags implements ITags { if(!$this->hasTag($name) && $name !== '') { $newones[] = new Tag($this->user, $this->type, $name); } - if(!is_null($id) ) { + if(!is_null($id)) { // Insert $objectid, $categoryid pairs if not exist. self::$relations[] = ['objid' => $id, 'tag' => $name]; } @@ -504,7 +504,7 @@ class Tags implements ITags { 'objid' => $relation['objid'], 'categoryid' => $tagId, 'type' => $this->type, - ]); + ]); } catch(\Exception $e) { \OC::$server->getLogger()->logException($e, [ 'message' => __METHOD__, @@ -522,12 +522,12 @@ class Tags implements ITags { } /** - * Delete tags and tag/object relations for a user. - * - * For hooking up on post_deleteUser - * - * @param array $arguments - */ + * Delete tags and tag/object relations for a user. + * + * For hooking up on post_deleteUser + * + * @param array $arguments + */ public static function post_deleteUser($arguments) { // Find all objectid/tagId pairs. $result = null; @@ -550,7 +550,7 @@ class Tags implements ITags { try { $stmt = \OC_DB::prepare('DELETE FROM `' . self::RELATION_TABLE . '` ' . 'WHERE `categoryid` = ?'); - while( $row = $result->fetchRow()) { + while($row = $result->fetchRow()) { try { $stmt->execute([$row['id']]); } catch(\Exception $e) { @@ -586,11 +586,11 @@ class Tags implements ITags { } /** - * Delete tag/object relations from the db - * - * @param array $ids The ids of the objects - * @return boolean Returns false on error. - */ + * Delete tag/object relations from the db + * + * @param array $ids The ids of the objects + * @return boolean Returns false on error. + */ public function purgeObjects(array $ids) { if(count($ids) === 0) { // job done ;) @@ -620,10 +620,10 @@ class Tags implements ITags { } /** - * Get favorites for an object type - * - * @return array|false An array of object ids. - */ + * Get favorites for an object type + * + * @return array|false An array of object ids. + */ public function getFavorites() { if(!$this->userHasTag(ITags::TAG_FAVORITE, $this->user)) { return []; @@ -642,11 +642,11 @@ class Tags implements ITags { } /** - * Add an object to favorites - * - * @param int $objid The id of the object - * @return boolean - */ + * Add an object to favorites + * + * @param int $objid The id of the object + * @return boolean + */ public function addToFavorites($objid) { if(!$this->userHasTag(ITags::TAG_FAVORITE, $this->user)) { $this->add(ITags::TAG_FAVORITE); @@ -655,22 +655,22 @@ class Tags implements ITags { } /** - * Remove an object from favorites - * - * @param int $objid The id of the object - * @return boolean - */ + * Remove an object from favorites + * + * @param int $objid The id of the object + * @return boolean + */ public function removeFromFavorites($objid) { return $this->unTag($objid, ITags::TAG_FAVORITE); } /** - * Creates a tag/object relation. - * - * @param int $objid The id of the object - * @param string $tag The id or name of the tag - * @return boolean Returns false on error. - */ + * Creates a tag/object relation. + * + * @param int $objid The id of the object + * @param string $tag The id or name of the tag + * @return boolean Returns false on error. + */ public function tagAs($objid, $tag) { if(is_string($tag) && !is_numeric($tag)) { $tag = trim($tag); @@ -704,12 +704,12 @@ class Tags implements ITags { } /** - * Delete single tag/object relation from the db - * - * @param int $objid The id of the object - * @param string $tag The id or name of the tag - * @return boolean - */ + * Delete single tag/object relation from the db + * + * @param int $objid The id of the object + * @param string $tag The id or name of the tag + * @return boolean + */ public function unTag($objid, $tag) { if(is_string($tag) && !is_numeric($tag)) { $tag = trim($tag); @@ -739,11 +739,11 @@ class Tags implements ITags { } /** - * Delete tags from the database. - * - * @param string[]|integer[] $names An array of tags (names or IDs) to delete - * @return bool Returns false on error - */ + * Delete tags from the database. + * + * @param string[]|integer[] $names An array of tags (names or IDs) to delete + * @return bool Returns false on error + */ public function delete($names) { if(!is_array($names)) { $names = [$names]; @@ -802,18 +802,18 @@ class Tags implements ITags { return false; } return array_search(strtolower($needle), array_map( - function($tag) use($mem) { + function ($tag) use ($mem) { return strtolower(call_user_func([$tag, $mem])); }, $haystack) ); } /** - * Get a tag's ID. - * - * @param string $name The tag name to look for. - * @return string|bool The tag's id or false if no matching tag is found. - */ + * Get a tag's ID. + * + * @param string $name The tag name to look for. + * @return string|bool The tag's id or false if no matching tag is found. + */ private function getTagId($name) { $key = $this->array_searchi($name, $this->tags); if ($key !== false) { @@ -823,34 +823,34 @@ class Tags implements ITags { } /** - * Get a tag by its name. - * - * @param string $name The tag name. - * @return integer|bool The tag object's offset within the $this->tags - * array or false if it doesn't exist. - */ + * Get a tag by its name. + * + * @param string $name The tag name. + * @return integer|bool The tag object's offset within the $this->tags + * array or false if it doesn't exist. + */ private function getTagByName($name) { return $this->array_searchi($name, $this->tags, 'getName'); } /** - * Get a tag by its ID. - * - * @param string $id The tag ID to look for. - * @return integer|bool The tag object's offset within the $this->tags - * array or false if it doesn't exist. - */ + * Get a tag by its ID. + * + * @param string $id The tag ID to look for. + * @return integer|bool The tag object's offset within the $this->tags + * array or false if it doesn't exist. + */ private function getTagById($id) { return $this->array_searchi($id, $this->tags, 'getId'); } /** - * Returns an array mapping a given tag's properties to its values: - * ['id' => 0, 'name' = 'Tag', 'owner' = 'User', 'type' => 'tagtype'] - * - * @param Tag $tag The tag that is going to be mapped - * @return array - */ + * Returns an array mapping a given tag's properties to its values: + * ['id' => 0, 'name' = 'Tag', 'owner' = 'User', 'type' => 'tagtype'] + * + * @param Tag $tag The tag that is going to be mapped + * @return array + */ private function tagMap(Tag $tag) { return [ 'id' => $tag->getId(), diff --git a/lib/private/Template/Base.php b/lib/private/Template/Base.php index 9ac74ffc60c..d07cf2249f7 100644 --- a/lib/private/Template/Base.php +++ b/lib/private/Template/Base.php @@ -48,7 +48,7 @@ class Base { * @param \OCP\IL10N $l10n * @param Defaults $theme */ - public function __construct($template, $requestToken, $l10n, $theme ) { + public function __construct($template, $requestToken, $l10n, $theme) { $this->vars = []; $this->vars['requesttoken'] = $requestToken; $this->l10n = $l10n; @@ -65,7 +65,7 @@ class Base { */ protected function getAppTemplateDirs($theme, $app, $serverRoot, $app_dir) { // Check if the app is in the app folder or in the root - if( file_exists($app_dir.'/templates/' )) { + if(file_exists($app_dir.'/templates/')) { return [ $serverRoot.'/themes/'.$theme.'/apps/'.$app.'/templates/', $app_dir.'/templates/', @@ -100,7 +100,7 @@ class Base { * * If the key existed before, it will be overwritten */ - public function assign( $key, $value) { + public function assign($key, $value) { $this->vars[$key] = $value; return true; } @@ -114,8 +114,8 @@ class Base { * exists, the value will be appended. It can be accessed via * $_[$key][$position] in the template. */ - public function append( $key, $value ) { - if( array_key_exists( $key, $this->vars )) { + public function append($key, $value) { + if(array_key_exists($key, $this->vars)) { $this->vars[$key][] = $value; } else{ @@ -131,7 +131,7 @@ class Base { */ public function printPage() { $data = $this->fetchPage(); - if( $data === false ) { + if($data === false) { return false; } else{ @@ -168,7 +168,7 @@ class Base { $theme = $this->theme; if(!is_null($additionalParams)) { - $_ = array_merge( $additionalParams, $this->vars ); + $_ = array_merge($additionalParams, $this->vars); foreach ($_ as $var => $value) { ${$var} = $value; } diff --git a/lib/private/Template/TemplateFileLocator.php b/lib/private/Template/TemplateFileLocator.php index f1f5fefc6f5..afeddd6b544 100644 --- a/lib/private/Template/TemplateFileLocator.php +++ b/lib/private/Template/TemplateFileLocator.php @@ -32,7 +32,7 @@ class TemplateFileLocator { /** * @param string[] $dirs */ - public function __construct( $dirs ) { + public function __construct($dirs) { $this->dirs = $dirs; } @@ -41,7 +41,7 @@ class TemplateFileLocator { * @return string * @throws \Exception */ - public function find( $template ) { + public function find($template) { if ($template === '') { throw new \InvalidArgumentException('Empty template name'); } diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php index 5562d4b5e2a..968ae7fceb8 100644 --- a/lib/private/TemplateLayout.php +++ b/lib/private/TemplateLayout.php @@ -64,7 +64,7 @@ class TemplateLayout extends \OC_Template { * @param string $renderAs * @param string $appId application id */ - public function __construct( $renderAs, $appId = '' ) { + public function __construct($renderAs, $appId = '') { // yes - should be injected .... $this->config = \OC::$server->getConfig(); @@ -75,7 +75,7 @@ class TemplateLayout extends \OC_Template { // Decide which page we show if($renderAs === 'user') { - parent::__construct( 'core', 'layout.user' ); + parent::__construct('core', 'layout.user'); if(in_array(\OC_App::getCurrentApp(), ['settings','admin', 'help']) !== false) { $this->assign('bodyid', 'body-settings'); }else{ @@ -83,22 +83,22 @@ class TemplateLayout extends \OC_Template { } // Add navigation entry - $this->assign( 'application', ''); - $this->assign( 'appid', $appId ); + $this->assign('application', ''); + $this->assign('appid', $appId); $navigation = \OC::$server->getNavigationManager()->getAll(); - $this->assign( 'navigation', $navigation); + $this->assign('navigation', $navigation); $settingsNavigation = \OC::$server->getNavigationManager()->getAll('settings'); - $this->assign( 'settingsnavigation', $settingsNavigation); + $this->assign('settingsnavigation', $settingsNavigation); foreach($navigation as $entry) { if ($entry['active']) { - $this->assign( 'application', $entry['name'] ); + $this->assign('application', $entry['name']); break; } } foreach($settingsNavigation as $entry) { if ($entry['active']) { - $this->assign( 'application', $entry['name'] ); + $this->assign('application', $entry['name']); break; } } @@ -139,7 +139,7 @@ class TemplateLayout extends \OC_Template { $this->assign('user_uid', \OC_User::getUser()); } else if ($renderAs === 'public') { parent::__construct('core', 'layout.public'); - $this->assign( 'appid', $appId ); + $this->assign('appid', $appId); $this->assign('bodyid', 'body-public'); /** @var IRegistry $subscription */ @@ -196,7 +196,7 @@ class TemplateLayout extends \OC_Template { foreach($jsFiles as $info) { $web = $info[1]; $file = $info[2]; - $this->append( 'jsfiles', $web.'/'.$file . $this->getVersionHashSuffix() ); + $this->append('jsfiles', $web.'/'.$file . $this->getVersionHashSuffix()); } try { @@ -229,14 +229,14 @@ class TemplateLayout extends \OC_Template { $file = $info[2]; if (substr($file, -strlen('print.css')) === 'print.css') { - $this->append( 'printcssfiles', $web.'/'.$file . $this->getVersionHashSuffix() ); + $this->append('printcssfiles', $web.'/'.$file . $this->getVersionHashSuffix()); } else { $suffix = $this->getVersionHashSuffix($web, $file); if (strpos($file, '?v=') == false) { - $this->append( 'cssfiles', $web.'/'.$file . $suffix); + $this->append('cssfiles', $web.'/'.$file . $suffix); } else { - $this->append( 'cssfiles', $web.'/'.$file . '-' . substr($suffix, 3)); + $this->append('cssfiles', $web.'/'.$file . '-' . substr($suffix, 3)); } } @@ -249,7 +249,7 @@ class TemplateLayout extends \OC_Template { /** * @param string $path - * @param string $file + * @param string $file * @return string */ protected function getVersionHashSuffix($path = false, $file = false) { diff --git a/lib/private/URLGenerator.php b/lib/private/URLGenerator.php index 62eafaafedb..c0896ec3516 100644 --- a/lib/private/URLGenerator.php +++ b/lib/private/URLGenerator.php @@ -122,7 +122,7 @@ class URLGenerator implements IURLGenerator { public function linkTo(string $app, string $file, array $args = []): string { $frontControllerActive = ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true'); - if( $app !== '' ) { + if($app !== '') { $app_path = \OC_App::getAppPath($app); // Check if the app is in the app folder if ($app_path && file_exists($app_path . '/' . $file)) { diff --git a/lib/private/Updater.php b/lib/private/Updater.php index 91a0943e048..e94f36554d7 100644 --- a/lib/private/Updater.php +++ b/lib/private/Updater.php @@ -495,20 +495,20 @@ class Updater extends BasicEmitter { $log = $this->log; $dispatcher = \OC::$server->getEventDispatcher(); - $dispatcher->addListener('\OC\DB\Migrator::executeSql', function($event) use ($log) { + $dispatcher->addListener('\OC\DB\Migrator::executeSql', function ($event) use ($log) { if (!$event instanceof GenericEvent) { return; } $log->info('\OC\DB\Migrator::executeSql: ' . $event->getSubject() . ' (' . $event->getArgument(0) . ' of ' . $event->getArgument(1) . ')', ['app' => 'updater']); }); - $dispatcher->addListener('\OC\DB\Migrator::checkTable', function($event) use ($log) { + $dispatcher->addListener('\OC\DB\Migrator::checkTable', function ($event) use ($log) { if (!$event instanceof GenericEvent) { return; } $log->info('\OC\DB\Migrator::checkTable: ' . $event->getSubject() . ' (' . $event->getArgument(0) . ' of ' . $event->getArgument(1) . ')', ['app' => 'updater']); }); - $repairListener = function($event) use ($log) { + $repairListener = function ($event) use ($log) { if (!$event instanceof GenericEvent) { return; } @@ -551,44 +551,44 @@ class Updater extends BasicEmitter { $dispatcher->addListener('\OC\Repair::error', $repairListener); - $this->listen('\OC\Updater', 'maintenanceEnabled', function () use($log) { + $this->listen('\OC\Updater', 'maintenanceEnabled', function () use ($log) { $log->info('\OC\Updater::maintenanceEnabled: Turned on maintenance mode', ['app' => 'updater']); }); - $this->listen('\OC\Updater', 'maintenanceDisabled', function () use($log) { + $this->listen('\OC\Updater', 'maintenanceDisabled', function () use ($log) { $log->info('\OC\Updater::maintenanceDisabled: Turned off maintenance mode', ['app' => 'updater']); }); - $this->listen('\OC\Updater', 'maintenanceActive', function () use($log) { + $this->listen('\OC\Updater', 'maintenanceActive', function () use ($log) { $log->info('\OC\Updater::maintenanceActive: Maintenance mode is kept active', ['app' => 'updater']); }); - $this->listen('\OC\Updater', 'updateEnd', function ($success) use($log) { + $this->listen('\OC\Updater', 'updateEnd', function ($success) use ($log) { if ($success) { $log->info('\OC\Updater::updateEnd: Update successful', ['app' => 'updater']); } else { $log->error('\OC\Updater::updateEnd: Update failed', ['app' => 'updater']); } }); - $this->listen('\OC\Updater', 'dbUpgradeBefore', function () use($log) { + $this->listen('\OC\Updater', 'dbUpgradeBefore', function () use ($log) { $log->info('\OC\Updater::dbUpgradeBefore: Updating database schema', ['app' => 'updater']); }); - $this->listen('\OC\Updater', 'dbUpgrade', function () use($log) { + $this->listen('\OC\Updater', 'dbUpgrade', function () use ($log) { $log->info('\OC\Updater::dbUpgrade: Updated database', ['app' => 'updater']); }); - $this->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function () use($log) { + $this->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function () use ($log) { $log->info('\OC\Updater::dbSimulateUpgradeBefore: Checking whether the database schema can be updated (this can take a long time depending on the database size)', ['app' => 'updater']); }); - $this->listen('\OC\Updater', 'dbSimulateUpgrade', function () use($log) { + $this->listen('\OC\Updater', 'dbSimulateUpgrade', function () use ($log) { $log->info('\OC\Updater::dbSimulateUpgrade: Checked database schema update', ['app' => 'updater']); }); - $this->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use($log) { + $this->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use ($log) { $log->info('\OC\Updater::incompatibleAppDisabled: Disabled incompatible app: ' . $app, ['app' => 'updater']); }); - $this->listen('\OC\Updater', 'checkAppStoreAppBefore', function ($app) use($log) { + $this->listen('\OC\Updater', 'checkAppStoreAppBefore', function ($app) use ($log) { $log->info('\OC\Updater::checkAppStoreAppBefore: Checking for update of app "' . $app . '" in appstore', ['app' => 'updater']); }); - $this->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use($log) { + $this->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use ($log) { $log->info('\OC\Updater::upgradeAppStoreApp: Update app "' . $app . '" from appstore', ['app' => 'updater']); }); - $this->listen('\OC\Updater', 'checkAppStoreApp', function ($app) use($log) { + $this->listen('\OC\Updater', 'checkAppStoreApp', function ($app) use ($log) { $log->info('\OC\Updater::checkAppStoreApp: Checked for update of app "' . $app . '" in appstore', ['app' => 'updater']); }); $this->listen('\OC\Updater', 'appUpgradeCheckBefore', function () use ($log) { @@ -606,19 +606,19 @@ class Updater extends BasicEmitter { $this->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($log) { $log->info('\OC\Updater::appUpgrade: Updated <' . $app . '> to ' . $version, ['app' => 'updater']); }); - $this->listen('\OC\Updater', 'failure', function ($message) use($log) { + $this->listen('\OC\Updater', 'failure', function ($message) use ($log) { $log->error('\OC\Updater::failure: ' . $message, ['app' => 'updater']); }); - $this->listen('\OC\Updater', 'setDebugLogLevel', function () use($log) { + $this->listen('\OC\Updater', 'setDebugLogLevel', function () use ($log) { $log->info('\OC\Updater::setDebugLogLevel: Set log level to debug', ['app' => 'updater']); }); - $this->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use($log) { + $this->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use ($log) { $log->info('\OC\Updater::resetLogLevel: Reset log level to ' . $logLevelName . '(' . $logLevel . ')', ['app' => 'updater']); }); - $this->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use($log) { + $this->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use ($log) { $log->info('\OC\Updater::startCheckCodeIntegrity: Starting code integrity check...', ['app' => 'updater']); }); - $this->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use($log) { + $this->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use ($log) { $log->info('\OC\Updater::finishedCheckCodeIntegrity: Finished code integrity check', ['app' => 'updater']); }); diff --git a/lib/private/User/Backend.php b/lib/private/User/Backend.php index 8fa2f3018b2..e90cfdc2e3d 100644 --- a/lib/private/User/Backend.php +++ b/lib/private/User/Backend.php @@ -60,15 +60,15 @@ abstract class Backend implements UserInterface { ]; /** - * Get all supported actions - * @return int bitwise-or'ed actions - * - * Returns the supported actions as int to be - * compared with self::CREATE_USER etc. - */ + * Get all supported actions + * @return int bitwise-or'ed actions + * + * Returns the supported actions as int to be + * compared with self::CREATE_USER etc. + */ public function getSupportedActions() { $actions = 0; - foreach($this->possibleActions AS $action => $methodName) { + foreach($this->possibleActions as $action => $methodName) { if(method_exists($this, $methodName)) { $actions |= $action; } @@ -78,13 +78,13 @@ abstract class Backend implements UserInterface { } /** - * Check if backend implements actions - * @param int $actions bitwise-or'ed actions - * @return boolean - * - * Returns the supported actions as int to be - * compared with self::CREATE_USER etc. - */ + * Check if backend implements actions + * @param int $actions bitwise-or'ed actions + * @return boolean + * + * Returns the supported actions as int to be + * compared with self::CREATE_USER etc. + */ public function implementsActions($actions) { return (bool)($this->getSupportedActions() & $actions); } @@ -96,7 +96,7 @@ abstract class Backend implements UserInterface { * * Deletes a user */ - public function deleteUser( $uid ) { + public function deleteUser($uid) { return false; } @@ -113,19 +113,19 @@ abstract class Backend implements UserInterface { } /** - * check if a user exists - * @param string $uid the username - * @return boolean - */ + * check if a user exists + * @param string $uid the username + * @return boolean + */ public function userExists($uid) { return false; } /** - * get the user's home directory - * @param string $uid the username - * @return boolean - */ + * get the user's home directory + * @param string $uid the username + * @return boolean + */ public function getHome($uid) { return false; } @@ -150,7 +150,7 @@ abstract class Backend implements UserInterface { public function getDisplayNames($search = '', $limit = null, $offset = null) { $displayNames = []; $users = $this->getUsers($search, $limit, $offset); - foreach ( $users as $user) { + foreach ($users as $user) { $displayNames[$user] = $user; } return $displayNames; diff --git a/lib/private/User/Database.php b/lib/private/User/Database.php index 856959a4596..c89d3ce3690 100644 --- a/lib/private/User/Database.php +++ b/lib/private/User/Database.php @@ -78,13 +78,13 @@ use OCP\User\Backend\ISetPasswordBackend; */ class Database extends ABackend implements ICreateUserBackend, - ISetPasswordBackend, - ISetDisplayNameBackend, - IGetDisplayNameBackend, - ICheckPasswordBackend, - IGetHomeBackend, - ICountUsersBackend, - IGetRealUIDBackend { + ISetPasswordBackend, + ISetDisplayNameBackend, + IGetDisplayNameBackend, + ICheckPasswordBackend, + IGetHomeBackend, + ICountUsersBackend, + IGetRealUIDBackend { /** @var CappedMemoryCache */ private $cache; diff --git a/lib/private/User/Manager.php b/lib/private/User/Manager.php index 2dd12cf916d..1ab335eeea6 100644 --- a/lib/private/User/Manager.php +++ b/lib/private/User/Manager.php @@ -422,7 +422,7 @@ class Manager extends PublicEmitter implements IUserManager { public function countUsersOfGroups(array $groups) { $users = []; foreach($groups as $group) { - $usersIds = array_map(function($user) { + $usersIds = array_map(function ($user) { return $user->getUID(); }, $group->getUsers()); $users = array_merge($users, $usersIds); @@ -618,11 +618,11 @@ class Manager extends PublicEmitter implements IUserManager { public function getByEmail($email) { $userIds = $this->config->getUsersForUserValueCaseInsensitive('settings', 'email', $email); - $users = array_map(function($uid) { + $users = array_map(function ($uid) { return $this->get($uid); }, $userIds); - return array_values(array_filter($users, function($u) { + return array_values(array_filter($users, function ($u) { return ($u instanceof IUser); })); } diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php index 9129fb7054b..7b129a393e3 100644 --- a/lib/private/User/Session.php +++ b/lib/private/User/Session.php @@ -51,7 +51,6 @@ use OC_User; use OC_Util; use OCA\DAV\Connector\Sabre\Auth; use OCP\AppFramework\Utility\ITimeFactory; -use OCP\Authentication\Events\LoginFailedEvent; use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\NotPermittedException; use OCP\IConfig; @@ -59,7 +58,6 @@ use OCP\ILogger; use OCP\IRequest; use OCP\ISession; use OCP\IUser; -use OCP\IUserManager; use OCP\IUserSession; use OCP\Lockdown\ILockdownManager; use OCP\Security\ISecureRandom; @@ -461,7 +459,7 @@ class Session implements IUserSession, Emitter { } // Try to login with this username and password - if (!$this->login($user, $password) ) { + if (!$this->login($user, $password)) { // Failed, maybe the user used their email address $users = $this->manager->getByEmail($user); diff --git a/lib/private/User/User.php b/lib/private/User/User.php index 0f17af3063e..bc492a6df29 100644 --- a/lib/private/User/User.php +++ b/lib/private/User/User.php @@ -449,7 +449,7 @@ class User implements IUser { public function getCloudId() { $uid = $this->getUID(); $server = $this->urlGenerator->getAbsoluteURL('/'); - $server = rtrim( $this->removeProtocolFromUrl($server), '/'); + $server = rtrim($this->removeProtocolFromUrl($server), '/'); return \OC::$server->getCloudIdManager()->getCloudId($uid, $server)->getId(); } diff --git a/lib/private/legacy/OC_DB.php b/lib/private/legacy/OC_DB.php index 34cc39f26aa..cf45faae314 100644 --- a/lib/private/legacy/OC_DB.php +++ b/lib/private/legacy/OC_DB.php @@ -58,7 +58,7 @@ class OC_DB { * * SQL query via Doctrine prepare(), needs to be execute()'d! */ - static public function prepare( $query , $limit = null, $offset = null, $isManipulation = null) { + static public function prepare($query , $limit = null, $offset = null, $isManipulation = null) { $connection = \OC::$server->getDatabaseConnection(); if ($isManipulation === null) { @@ -84,7 +84,7 @@ class OC_DB { * @param string $sql * @return bool */ - static public function isManipulation( $sql ) { + static public function isManipulation($sql) { $selectOccurrence = stripos($sql, 'SELECT'); if ($selectOccurrence !== false && $selectOccurrence < 10) { return false; @@ -113,7 +113,7 @@ class OC_DB { * @return OC_DB_StatementWrapper * @throws \OC\DatabaseException */ - static public function executeAudited( $stmt, array $parameters = []) { + static public function executeAudited($stmt, array $parameters = []) { if (is_string($stmt)) { // convert to an array with 'sql' if (stripos($stmt, 'LIMIT') !== false) { //OFFSET requires LIMIT, so we only need to check for LIMIT @@ -126,14 +126,14 @@ class OC_DB { } if (is_array($stmt)) { // convert to prepared statement - if ( ! array_key_exists('sql', $stmt) ) { + if (! array_key_exists('sql', $stmt)) { $message = 'statement array must at least contain key \'sql\''; throw new \OC\DatabaseException($message); } - if ( ! array_key_exists('limit', $stmt) ) { + if (! array_key_exists('limit', $stmt)) { $stmt['limit'] = null; } - if ( ! array_key_exists('limit', $stmt) ) { + if (! array_key_exists('limit', $stmt)) { $stmt['offset'] = null; } $stmt = self::prepare($stmt['sql'], $stmt['limit'], $stmt['offset']); @@ -172,7 +172,7 @@ class OC_DB { * * TODO: write more documentation */ - public static function createDbFromStructure( $file ) { + public static function createDbFromStructure($file) { $schemaManager = self::getMDB2SchemaManager(); return $schemaManager->createDbFromStructure($file); } diff --git a/lib/private/legacy/OC_DB_StatementWrapper.php b/lib/private/legacy/OC_DB_StatementWrapper.php index 872e8f64e79..d4072caf28e 100644 --- a/lib/private/legacy/OC_DB_StatementWrapper.php +++ b/lib/private/legacy/OC_DB_StatementWrapper.php @@ -114,7 +114,7 @@ class OC_DB_StatementWrapper { * @param integer|null $length max length when using an OUT bind * @return boolean */ - public function bindParam($column, &$variable, $type = null, $length = null){ + public function bindParam($column, &$variable, $type = null, $length = null) { return $this->statement->bindParam($column, $variable, $type, $length); } } diff --git a/lib/private/legacy/OC_Defaults.php b/lib/private/legacy/OC_Defaults.php index 73443adb031..d5a4b5eecee 100644 --- a/lib/private/legacy/OC_Defaults.php +++ b/lib/private/legacy/OC_Defaults.php @@ -322,7 +322,7 @@ class OC_Defaults { } else { $logo = \OC::$server->getURLGenerator()->imagePath('core', 'logo/logo.png'); } - return $logo . '?v=' . hash('sha1', implode('.', \OCP\Util::getVersion())); + return $logo . '?v=' . hash('sha1', implode('.', \OCP\Util::getVersion())); } public function getTextColorPrimary() { diff --git a/lib/private/legacy/OC_Files.php b/lib/private/legacy/OC_Files.php index 249d3e5154f..710e0882010 100644 --- a/lib/private/legacy/OC_Files.php +++ b/lib/private/legacy/OC_Files.php @@ -84,19 +84,19 @@ class OC_Files { $type = \OC::$server->getMimeTypeDetector()->getSecureMimeType(\OC\Files\Filesystem::getMimeType($filename)); if ($fileSize > -1) { if (!empty($rangeArray)) { - http_response_code(206); - header('Accept-Ranges: bytes', true); - if (count($rangeArray) > 1) { + http_response_code(206); + header('Accept-Ranges: bytes', true); + if (count($rangeArray) > 1) { $type = 'multipart/byteranges; boundary='.self::getBoundary(); // no Content-Length header here - } - else { + } + else { header(sprintf('Content-Range: bytes %d-%d/%d', $rangeArray[0]['from'], $rangeArray[0]['to'], $fileSize), true); OC_Response::setContentLengthHeader($rangeArray[0]['to'] - $rangeArray[0]['from'] + 1); - } + } } else { - OC_Response::setContentLengthHeader($fileSize); + OC_Response::setContentLengthHeader($fileSize); } } header('Content-Type: '.$type, true); @@ -329,10 +329,10 @@ class OC_Files { if (!empty($rangeArray)) { try { - if (count($rangeArray) == 1) { + if (count($rangeArray) == 1) { $view->readfilePart($filename, $rangeArray[0]['from'], $rangeArray[0]['to']); - } - else { + } + else { // check if file is seekable (if not throw UnseekableException) // we have to check it before body contents $view->readfilePart($filename, $rangeArray[0]['size'], $rangeArray[0]['size']); @@ -340,24 +340,24 @@ class OC_Files { $type = \OC::$server->getMimeTypeDetector()->getSecureMimeType(\OC\Files\Filesystem::getMimeType($filename)); foreach ($rangeArray as $range) { - echo "\r\n--".self::getBoundary()."\r\n". - "Content-type: ".$type."\r\n". - "Content-range: bytes ".$range['from']."-".$range['to']."/".$range['size']."\r\n\r\n"; - $view->readfilePart($filename, $range['from'], $range['to']); + echo "\r\n--".self::getBoundary()."\r\n". + "Content-type: ".$type."\r\n". + "Content-range: bytes ".$range['from']."-".$range['to']."/".$range['size']."\r\n\r\n"; + $view->readfilePart($filename, $range['from'], $range['to']); } echo "\r\n--".self::getBoundary()."--\r\n"; - } + } } catch (\OCP\Files\UnseekableException $ex) { - // file is unseekable - header_remove('Accept-Ranges'); - header_remove('Content-Range'); - http_response_code(200); - self::sendHeaders($filename, $name, []); - $view->readfile($filename); + // file is unseekable + header_remove('Accept-Ranges'); + header_remove('Content-Range'); + http_response_code(200); + self::sendHeaders($filename, $name, []); + $view->readfile($filename); } } else { - $view->readfile($filename); + $view->readfile($filename); } } @@ -399,7 +399,7 @@ class OC_Files { $view->lockFile($file, ILockingProvider::LOCK_SHARED); if ($view->is_dir($file)) { $contents = $view->getDirectoryContent($file); - $contents = array_map(function($fileInfo) use ($file) { + $contents = array_map(function ($fileInfo) use ($file) { /** @var \OCP\Files\FileInfo $fileInfo */ return $file . '/' . $fileInfo->getName(); }, $contents); diff --git a/lib/private/legacy/OC_Helper.php b/lib/private/legacy/OC_Helper.php index 626295af5a9..73154909a4a 100644 --- a/lib/private/legacy/OC_Helper.php +++ b/lib/private/legacy/OC_Helper.php @@ -44,7 +44,6 @@ * */ -use OCP\IUser; use Symfony\Component\Process\ExecutableFinder; /** @@ -368,7 +367,7 @@ class OC_Helper { $it = new RecursiveIteratorIterator($aIt); while ($it->valid()) { - if (((isset($index) AND ($it->key() == $index)) OR !isset($index)) AND ($it->current() == $needle)) { + if (((isset($index) and ($it->key() == $index)) or !isset($index)) and ($it->current() == $needle)) { return $aIt->key(); } diff --git a/lib/private/legacy/OC_Hook.php b/lib/private/legacy/OC_Hook.php index 2918dd4282f..b98424711dd 100644 --- a/lib/private/legacy/OC_Hook.php +++ b/lib/private/legacy/OC_Hook.php @@ -51,15 +51,15 @@ class OC_Hook { * * TODO: write example */ - static public function connect($signalClass, $signalName, $slotClass, $slotName ) { + static public function connect($signalClass, $signalName, $slotClass, $slotName) { // If we're trying to connect to an emitting class that isn't // yet registered, register it - if( !array_key_exists($signalClass, self::$registered )) { + if(!array_key_exists($signalClass, self::$registered)) { self::$registered[$signalClass] = []; } // If we're trying to connect to an emitting method that isn't // yet registered, register it with the emitting class - if( !array_key_exists( $signalName, self::$registered[$signalClass] )) { + if(!array_key_exists($signalName, self::$registered[$signalClass])) { self::$registered[$signalClass][$signalName] = []; } @@ -71,8 +71,8 @@ class OC_Hook { } // Connect the hook handler to the requested emitter self::$registered[$signalClass][$signalName][] = [ - "class" => $slotClass, - "name" => $slotName + "class" => $slotClass, + "name" => $slotName ]; // No chance for failure ;-) @@ -95,20 +95,20 @@ class OC_Hook { // Return false if no hook handlers are listening to this // emitting class - if( !array_key_exists($signalClass, self::$registered )) { + if(!array_key_exists($signalClass, self::$registered)) { return false; } // Return false if no hook handlers are listening to this // emitting method - if( !array_key_exists( $signalName, self::$registered[$signalClass] )) { + if(!array_key_exists($signalName, self::$registered[$signalClass])) { return false; } // Call all slots - foreach( self::$registered[$signalClass][$signalName] as $i ) { + foreach(self::$registered[$signalClass][$signalName] as $i) { try { - call_user_func( [ $i["class"], $i["name"] ], $params ); + call_user_func([ $i["class"], $i["name"] ], $params); } catch (Exception $e){ self::$thrownExceptions[] = $e; \OC::$server->getLogger()->logException($e); diff --git a/lib/private/legacy/OC_JSON.php b/lib/private/legacy/OC_JSON.php index f83fca0a433..5b4b97e6fd0 100644 --- a/lib/private/legacy/OC_JSON.php +++ b/lib/private/legacy/OC_JSON.php @@ -42,7 +42,7 @@ class OC_JSON{ * @suppress PhanDeprecatedFunction */ public static function checkAppEnabled($app) { - if( !\OC::$server->getAppManager()->isEnabledForUser($app)) { + if(!\OC::$server->getAppManager()->isEnabledForUser($app)) { $l = \OC::$server->getL10N('lib'); self::error([ 'data' => [ 'message' => $l->t('Application is not enabled'), 'error' => 'application_not_enabled' ]]); exit(); @@ -56,7 +56,7 @@ class OC_JSON{ */ public static function checkLoggedIn() { $twoFactorAuthManger = \OC::$server->getTwoFactorAuthManager(); - if( !\OC::$server->getUserSession()->isLoggedIn() + if(!\OC::$server->getUserSession()->isLoggedIn() || $twoFactorAuthManger->needsSecondFactor(\OC::$server->getUserSession()->getUser())) { $l = \OC::$server->getL10N('lib'); http_response_code(\OCP\AppFramework\Http::STATUS_UNAUTHORIZED); @@ -76,7 +76,7 @@ class OC_JSON{ exit(); } - if( !\OC::$server->getRequest()->passesCSRFCheck()) { + if(!\OC::$server->getRequest()->passesCSRFCheck()) { $l = \OC::$server->getL10N('lib'); self::error([ 'data' => [ 'message' => $l->t('Token expired. Please reload page.'), 'error' => 'token_expired' ]]); exit(); @@ -89,7 +89,7 @@ class OC_JSON{ * @suppress PhanDeprecatedFunction */ public static function checkAdminUser() { - if( !OC_User::isAdminUser(OC_User::getUser())) { + if(!OC_User::isAdminUser(OC_User::getUser())) { $l = \OC::$server->getL10N('lib'); self::error([ 'data' => [ 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' ]]); exit(); @@ -103,7 +103,7 @@ class OC_JSON{ */ public static function error($data = []) { $data['status'] = 'error'; - header( 'Content-Type: application/json; charset=utf-8'); + header('Content-Type: application/json; charset=utf-8'); echo self::encode($data); } @@ -114,7 +114,7 @@ class OC_JSON{ */ public static function success($data = []) { $data['status'] = 'success'; - header( 'Content-Type: application/json; charset=utf-8'); + header('Content-Type: application/json; charset=utf-8'); echo self::encode($data); } diff --git a/lib/private/legacy/OC_Response.php b/lib/private/legacy/OC_Response.php index 4eb454d3181..45fea27d61d 100644 --- a/lib/private/legacy/OC_Response.php +++ b/lib/private/legacy/OC_Response.php @@ -33,17 +33,17 @@ class OC_Response { * @param string $filename file name * @param string $type disposition type, either 'attachment' or 'inline' */ - static public function setContentDispositionHeader( $filename, $type = 'attachment' ) { + static public function setContentDispositionHeader($filename, $type = 'attachment') { if (\OC::$server->getRequest()->isUserAgent( [ \OC\AppFramework\Http\Request::USER_AGENT_IE, \OC\AppFramework\Http\Request::USER_AGENT_ANDROID_MOBILE_CHROME, \OC\AppFramework\Http\Request::USER_AGENT_FREEBOX, ])) { - header( 'Content-Disposition: ' . rawurlencode($type) . '; filename="' . rawurlencode( $filename ) . '"' ); + header('Content-Disposition: ' . rawurlencode($type) . '; filename="' . rawurlencode($filename) . '"'); } else { - header( 'Content-Disposition: ' . rawurlencode($type) . '; filename*=UTF-8\'\'' . rawurlencode( $filename ) - . '; filename="' . rawurlencode( $filename ) . '"' ); + header('Content-Disposition: ' . rawurlencode($type) . '; filename*=UTF-8\'\'' . rawurlencode($filename) + . '; filename="' . rawurlencode($filename) . '"'); } } diff --git a/lib/private/legacy/OC_Template.php b/lib/private/legacy/OC_Template.php index 279ceb8de0f..08f23b55a0f 100644 --- a/lib/private/legacy/OC_Template.php +++ b/lib/private/legacy/OC_Template.php @@ -72,7 +72,7 @@ class OC_Template extends \OC\Template\Base { * "admin". * @param bool $registerCall = true */ - public function __construct( $app, $name, $renderAs = "", $registerCall = true ) { + public function __construct($app, $name, $renderAs = "", $registerCall = true) { // Read the selected theme from the config file self::initTemplateEngine($renderAs); @@ -104,16 +104,16 @@ class OC_Template extends \OC\Template\Base { //apps that started before the template initialization can load their own scripts/styles //so to make sure this scripts/styles here are loaded first we use OC_Util::addScript() with $prepend=true //meaning the last script/style in this list will be loaded first - if (\OC::$server->getSystemConfig()->getValue ('installed', false) && $renderAs !== 'error' && !\OCP\Util::needUpgrade()) { - if (\OC::$server->getConfig ()->getAppValue ( 'core', 'backgroundjobs_mode', 'ajax' ) == 'ajax') { - OC_Util::addScript ( 'backgroundjobs', null, true ); + if (\OC::$server->getSystemConfig()->getValue('installed', false) && $renderAs !== 'error' && !\OCP\Util::needUpgrade()) { + if (\OC::$server->getConfig()->getAppValue('core', 'backgroundjobs_mode', 'ajax') == 'ajax') { + OC_Util::addScript('backgroundjobs', null, true); } } OC_Util::addStyle('css-variables', null, true); OC_Util::addStyle('server', null, true); OC_Util::addTranslations('core', null, true); - if (\OC::$server->getSystemConfig()->getValue ('installed', false)) { + if (\OC::$server->getSystemConfig()->getValue('installed', false)) { OC_Util::addStyle('search', 'results'); OC_Util::addScript('search', 'search', true); OC_Util::addScript('search', 'searchprovider'); @@ -146,12 +146,12 @@ class OC_Template extends \OC\Template\Base { */ protected function findTemplate($theme, $app, $name) { // Check if it is a app template or not. - if( $app !== '' ) { + if($app !== '') { $dirs = $this->getAppTemplateDirs($theme, $app, OC::$SERVERROOT, OC_App::getAppPath($app)); } else { $dirs = $this->getCoreTemplateDirs($theme, OC::$SERVERROOT); } - $locator = new \OC\Template\TemplateFileLocator( $dirs ); + $locator = new \OC\Template\TemplateFileLocator($dirs); $template = $locator->find($name); $path = $locator->getPath(); return [$path, $template]; @@ -182,7 +182,7 @@ class OC_Template extends \OC\Template\Base { public function fetchPage($additionalParams = null) { $data = parent::fetchPage($additionalParams); - if( $this->renderAs ) { + if($this->renderAs) { $page = new TemplateLayout($this->renderAs, $this->app); if(is_array($additionalParams)) { @@ -195,7 +195,7 @@ class OC_Template extends \OC\Template\Base { $headers = ''; foreach(OC_Util::$headers as $header) { $headers .= '<'.\OCP\Util::sanitizeHTML($header['tag']); - if ( strcasecmp($header['tag'], 'script') === 0 && in_array('src', array_map('strtolower', array_keys($header['attributes']))) ) { + if (strcasecmp($header['tag'], 'script') === 0 && in_array('src', array_map('strtolower', array_keys($header['attributes'])))) { $headers .= ' defer'; } foreach($header['attributes'] as $name=>$value) { @@ -227,7 +227,7 @@ class OC_Template extends \OC\Template\Base { * Includes another template. use <?php echo $this->inc('template'); ?> to * do this. */ - public function inc( $file, $additionalParams = null ) { + public function inc($file, $additionalParams = null) { return $this->load($this->path.$file.'.php', $additionalParams); } @@ -238,10 +238,10 @@ class OC_Template extends \OC\Template\Base { * @param array $parameters Parameters for the template * @return boolean|null */ - public static function printUserPage( $application, $name, $parameters = [] ) { - $content = new OC_Template( $application, $name, "user" ); - foreach( $parameters as $key => $value ) { - $content->assign( $key, $value ); + public static function printUserPage($application, $name, $parameters = []) { + $content = new OC_Template($application, $name, "user"); + foreach($parameters as $key => $value) { + $content->assign($key, $value); } print $content->printPage(); } @@ -253,10 +253,10 @@ class OC_Template extends \OC\Template\Base { * @param array $parameters Parameters for the template * @return bool */ - public static function printAdminPage( $application, $name, $parameters = [] ) { - $content = new OC_Template( $application, $name, "admin" ); - foreach( $parameters as $key => $value ) { - $content->assign( $key, $value ); + public static function printAdminPage($application, $name, $parameters = []) { + $content = new OC_Template($application, $name, "admin"); + foreach($parameters as $key => $value) { + $content->assign($key, $value); } return $content->printPage(); } @@ -268,10 +268,10 @@ class OC_Template extends \OC\Template\Base { * @param array|string $parameters Parameters for the template * @return bool */ - public static function printGuestPage( $application, $name, $parameters = [] ) { + public static function printGuestPage($application, $name, $parameters = []) { $content = new OC_Template($application, $name, $name === 'error' ? $name : 'guest'); - foreach( $parameters as $key => $value ) { - $content->assign( $key, $value ); + foreach($parameters as $key => $value) { + $content->assign($key, $value); } return $content->printPage(); } @@ -283,7 +283,7 @@ class OC_Template extends \OC\Template\Base { * @param int $statusCode * @suppress PhanAccessMethodInternal */ - public static function printErrorPage( $error_msg, $hint = '', $statusCode = 500) { + public static function printErrorPage($error_msg, $hint = '', $statusCode = 500) { if (\OC::$server->getAppManager()->isEnabledForUser('theming') && !\OC_App::isAppLoaded('theming')) { \OC_App::loadApp('theming'); } @@ -296,9 +296,9 @@ class OC_Template extends \OC\Template\Base { http_response_code($statusCode); try { - $content = new \OC_Template( '', 'error', 'error', false ); + $content = new \OC_Template('', 'error', 'error', false); $errors = [['error' => $error_msg, 'hint' => $hint]]; - $content->assign( 'errors', $errors ); + $content->assign('errors', $errors); $content->printPage(); } catch (\Exception $e) { $logger = \OC::$server->getLogger(); diff --git a/lib/private/legacy/OC_User.php b/lib/private/legacy/OC_User.php index d96400ad1d4..a9de5cdef9f 100644 --- a/lib/private/legacy/OC_User.php +++ b/lib/private/legacy/OC_User.php @@ -80,7 +80,7 @@ class OC_User { \OC::$server->getUserManager()->registerBackend($backend); } else { // You'll never know what happens - if (null === $backend OR !is_string($backend)) { + if (null === $backend or !is_string($backend)) { $backend = 'database'; } diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php index f14095675dc..4d7d00f5dc2 100644 --- a/lib/private/legacy/OC_Util.php +++ b/lib/private/legacy/OC_Util.php @@ -590,7 +590,7 @@ class OC_Util { // core js files need separate handling if ($application !== 'core' && $file !== null) { - self::addTranslations ( $application ); + self::addTranslations($application); } self::addExternalResource($application, $prepend, $path, "script"); } @@ -667,7 +667,7 @@ class OC_Util { if ($type === "style") { if (!in_array($path, self::$styles)) { if ($prepend === true) { - array_unshift ( self::$styles, $path ); + array_unshift(self::$styles, $path); } else { self::$styles[] = $path; } @@ -675,7 +675,7 @@ class OC_Util { } elseif ($type === "script") { if (!in_array($path, self::$scripts)) { if ($prepend === true) { - array_unshift ( self::$scripts, $path ); + array_unshift(self::$scripts, $path); } else { self::$scripts [] = $path; } @@ -699,7 +699,7 @@ class OC_Util { 'text' => $text ]; if ($prepend === true) { - array_unshift (self::$headers, $header); + array_unshift(self::$headers, $header); } else { self::$headers[] = $header; @@ -757,7 +757,7 @@ class OC_Util { 'hint' => $l->t('This can usually be fixed by giving the webserver write access to the config directory. See %s', [ $urlGenerator->linkToDocs('admin-dir_permissions') ]) . '. ' . $l->t('Or, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it. See %s', - [ $urlGenerator->linkToDocs('admin-config') ] ) + [ $urlGenerator->linkToDocs('admin-config') ]) ]; } } @@ -925,7 +925,7 @@ class OC_Util { } if(function_exists('xml_parser_create') && - LIBXML_LOADED_VERSION < 20700 ) { + LIBXML_LOADED_VERSION < 20700) { $version = LIBXML_LOADED_VERSION; $major = floor($version/10000); $version -= ($major * 10000); @@ -1163,7 +1163,7 @@ class OC_Util { */ public static function sanitizeHTML($value) { if (is_array($value)) { - $value = array_map(function($value) { + $value = array_map(function ($value) { return self::sanitizeHTML($value); }, $value); } else { diff --git a/lib/private/legacy/template/functions.php b/lib/private/legacy/template/functions.php index f2f737baf9a..e42ef796f0f 100644 --- a/lib/private/legacy/template/functions.php +++ b/lib/private/legacy/template/functions.php @@ -45,7 +45,7 @@ function p($string) { * Prints a <link> tag for loading css * @param string $href the source URL, ignored when empty * @param string $opts, additional optional options -*/ + */ function emit_css_tag($href, $opts = '') { $s='<link rel="stylesheet"'; if (!empty($href)) { @@ -60,7 +60,7 @@ function emit_css_tag($href, $opts = '') { /** * Prints all tags for CSS loading * @param array $obj all the script information from template -*/ + */ function emit_css_loading_tags($obj) { foreach($obj['cssfiles'] as $css) { emit_css_tag($css); @@ -74,7 +74,7 @@ function emit_css_loading_tags($obj) { * Prints a <script> tag with nonce and defer depending on config * @param string $src the source URL, ignored when empty * @param string $script_content the inline script content, ignored when empty -*/ + */ function emit_script_tag($src, $script_content='') { $defer_str=' defer'; $s='<script nonce="' . \OC::$server->getContentSecurityPolicyNonceManager()->getNonce() . '"'; @@ -95,7 +95,7 @@ function emit_script_tag($src, $script_content='') { /** * Print all <script> tags for loading JS * @param array $obj all the script information from template -*/ + */ function emit_script_loading_tags($obj) { foreach($obj['jsfiles'] as $jsfile) { emit_script_tag($jsfile, ''); @@ -214,7 +214,7 @@ function component($app, $file) { * * For further information have a look at \OCP\IURLGenerator::linkTo */ -function link_to( $app, $file, $args = [] ) { +function link_to($app, $file, $args = []) { return \OC::$server->getURLGenerator()->linkTo($app, $file, $args); } @@ -234,8 +234,8 @@ function link_to_docs($key) { * * For further information have a look at \OCP\IURLGenerator::imagePath */ -function image_path( $app, $image ) { - return \OC::$server->getURLGenerator()->imagePath( $app, $image ); +function image_path($app, $image) { + return \OC::$server->getURLGenerator()->imagePath($app, $image); } /** @@ -243,8 +243,8 @@ function image_path( $app, $image ) { * @param string $mimetype mimetype * @return string link to the image */ -function mimetype_icon( $mimetype ) { - return \OC::$server->getMimeTypeDetector()->mimeTypeIcon( $mimetype ); +function mimetype_icon($mimetype) { + return \OC::$server->getMimeTypeDetector()->mimeTypeIcon($mimetype); } /** @@ -253,7 +253,7 @@ function mimetype_icon( $mimetype ) { * @param string $path path of file * @return string link to the preview */ -function preview_icon( $path ) { +function preview_icon($path) { return \OC::$server->getURLGenerator()->linkToRoute('core.Preview.getPreview', ['x' => 32, 'y' => 32, 'file' => $path]); } @@ -262,7 +262,7 @@ function preview_icon( $path ) { * @param string $token * @return string */ -function publicPreview_icon ( $path, $token ) { +function publicPreview_icon($path, $token) { return \OC::$server->getURLGenerator()->linkToRoute('files_sharing.PublicPreview.getPreview', ['x' => 32, 'y' => 32, 'file' => $path, 'token' => $token]); } @@ -273,8 +273,8 @@ function publicPreview_icon ( $path, $token ) { * * For further information have a look at OC_Helper::humanFileSize */ -function human_file_size( $bytes ) { - return OC_Helper::humanFileSize( $bytes ); +function human_file_size($bytes) { + return OC_Helper::humanFileSize($bytes); } /** @@ -282,7 +282,7 @@ function human_file_size( $bytes ) { * @param int $timestamp UNIX timestamp to strip * @return int timestamp without time value */ -function strip_time($timestamp){ +function strip_time($timestamp) { $date = new \DateTime("@{$timestamp}"); $date->setTime(0, 0, 0); return (int)$date->format('U'); diff --git a/lib/public/Accounts/PropertyDoesNotExistException.php b/lib/public/Accounts/PropertyDoesNotExistException.php index 0aa5b4c394c..e9e57dd8779 100644 --- a/lib/public/Accounts/PropertyDoesNotExistException.php +++ b/lib/public/Accounts/PropertyDoesNotExistException.php @@ -37,7 +37,7 @@ class PropertyDoesNotExistException extends \Exception { * @param string $msg the error message * @since 15.0.0 */ - public function __construct($property){ + public function __construct($property) { parent::__construct('Property ' . $property . ' does not exist.'); } diff --git a/lib/public/Activity/IEventMerger.php b/lib/public/Activity/IEventMerger.php index a8f75875c6f..90d9cecb756 100644 --- a/lib/public/Activity/IEventMerger.php +++ b/lib/public/Activity/IEventMerger.php @@ -23,7 +23,6 @@ namespace OCP\Activity; - /** * Interface EventMerger * diff --git a/lib/public/App.php b/lib/public/App.php index 9b30ef4cf93..8e4a983c6bf 100644 --- a/lib/public/App.php +++ b/lib/public/App.php @@ -55,9 +55,9 @@ class App { * @return void * @since 4.0.0 * @deprecated 14.0.0 Use settings section in appinfo.xml to register personal admin sections - */ - public static function registerPersonal( $app, $page ) { - \OC_App::registerPersonal( $app, $page ); + */ + public static function registerPersonal($app, $page) { + \OC_App::registerPersonal($app, $page); } /** @@ -68,8 +68,8 @@ class App { * @since 4.0.0 * @deprecated 14.0.0 Use settings section in appinfo.xml to register admin sections */ - public static function registerAdmin( $app, $page ) { - \OC_App::registerAdmin( $app, $page ); + public static function registerAdmin($app, $page) { + \OC_App::registerAdmin($app, $page); } /** @@ -79,9 +79,9 @@ class App { * @return array|null * @deprecated 14.0.0 ise \OC::$server->getAppManager()->getAppInfo($appId) * @since 4.0.0 - */ - public static function getAppInfo( $app, $path=false ) { - return \OC_App::getAppInfo( $app, $path); + */ + public static function getAppInfo($app, $path=false) { + return \OC_App::getAppInfo($app, $path); } /** @@ -93,8 +93,8 @@ class App { * @since 4.0.0 * @deprecated 13.0.0 use \OC::$server->getAppManager()->isEnabledForUser($appId) */ - public static function isEnabled( $app ) { - return \OC::$server->getAppManager()->isEnabledForUser( $app ); + public static function isEnabled($app) { + return \OC::$server->getAppManager()->isEnabledForUser($app); } /** @@ -104,7 +104,7 @@ class App { * @since 4.0.0 * @deprecated 14.0.0 use \OC::$server->getAppManager()->getAppVersion($appId) */ - public static function getAppVersion( $app ) { + public static function getAppVersion($app) { return \OC::$server->getAppManager()->getAppVersion($app); } } diff --git a/lib/public/AppFramework/ApiController.php b/lib/public/AppFramework/ApiController.php index d09a2d5c290..feae56fc2c0 100644 --- a/lib/public/AppFramework/ApiController.php +++ b/lib/public/AppFramework/ApiController.php @@ -39,60 +39,60 @@ use OCP\IRequest; */ abstract class ApiController extends Controller { - private $corsMethods; - private $corsAllowedHeaders; - private $corsMaxAge; + private $corsMethods; + private $corsAllowedHeaders; + private $corsMaxAge; - /** - * constructor of the controller - * @param string $appName the name of the app - * @param IRequest $request an instance of the request - * @param string $corsMethods comma separated string of HTTP verbs which - * should be allowed for websites or webapps when calling your API, defaults to - * 'PUT, POST, GET, DELETE, PATCH' - * @param string $corsAllowedHeaders comma separated string of HTTP headers - * which should be allowed for websites or webapps when calling your API, - * defaults to 'Authorization, Content-Type, Accept' - * @param int $corsMaxAge number in seconds how long a preflighted OPTIONS - * request should be cached, defaults to 1728000 seconds + /** + * constructor of the controller + * @param string $appName the name of the app + * @param IRequest $request an instance of the request + * @param string $corsMethods comma separated string of HTTP verbs which + * should be allowed for websites or webapps when calling your API, defaults to + * 'PUT, POST, GET, DELETE, PATCH' + * @param string $corsAllowedHeaders comma separated string of HTTP headers + * which should be allowed for websites or webapps when calling your API, + * defaults to 'Authorization, Content-Type, Accept' + * @param int $corsMaxAge number in seconds how long a preflighted OPTIONS + * request should be cached, defaults to 1728000 seconds * @since 7.0.0 - */ - public function __construct($appName, - IRequest $request, - $corsMethods='PUT, POST, GET, DELETE, PATCH', - $corsAllowedHeaders='Authorization, Content-Type, Accept', - $corsMaxAge=1728000){ - parent::__construct($appName, $request); - $this->corsMethods = $corsMethods; - $this->corsAllowedHeaders = $corsAllowedHeaders; - $this->corsMaxAge = $corsMaxAge; - } + */ + public function __construct($appName, + IRequest $request, + $corsMethods='PUT, POST, GET, DELETE, PATCH', + $corsAllowedHeaders='Authorization, Content-Type, Accept', + $corsMaxAge=1728000) { + parent::__construct($appName, $request); + $this->corsMethods = $corsMethods; + $this->corsAllowedHeaders = $corsAllowedHeaders; + $this->corsMaxAge = $corsMaxAge; + } - /** - * This method implements a preflighted cors response for you that you can - * link to for the options request - * - * @NoAdminRequired - * @NoCSRFRequired - * @PublicPage + /** + * This method implements a preflighted cors response for you that you can + * link to for the options request + * + * @NoAdminRequired + * @NoCSRFRequired + * @PublicPage * @since 7.0.0 - */ - public function preflightedCors() { - if(isset($this->request->server['HTTP_ORIGIN'])) { - $origin = $this->request->server['HTTP_ORIGIN']; - } else { - $origin = '*'; - } + */ + public function preflightedCors() { + if(isset($this->request->server['HTTP_ORIGIN'])) { + $origin = $this->request->server['HTTP_ORIGIN']; + } else { + $origin = '*'; + } - $response = new Response(); - $response->addHeader('Access-Control-Allow-Origin', $origin); - $response->addHeader('Access-Control-Allow-Methods', $this->corsMethods); - $response->addHeader('Access-Control-Max-Age', (string)$this->corsMaxAge); - $response->addHeader('Access-Control-Allow-Headers', $this->corsAllowedHeaders); - $response->addHeader('Access-Control-Allow-Credentials', 'false'); - return $response; - } + $response = new Response(); + $response->addHeader('Access-Control-Allow-Origin', $origin); + $response->addHeader('Access-Control-Allow-Methods', $this->corsMethods); + $response->addHeader('Access-Control-Max-Age', (string)$this->corsMaxAge); + $response->addHeader('Access-Control-Allow-Headers', $this->corsAllowedHeaders); + $response->addHeader('Access-Control-Allow-Credentials', 'false'); + return $response; + } } diff --git a/lib/public/AppFramework/App.php b/lib/public/AppFramework/App.php index d6bf23e4afe..7bf9e72637b 100644 --- a/lib/public/AppFramework/App.php +++ b/lib/public/AppFramework/App.php @@ -37,6 +37,7 @@ declare(strict_types=1); */ namespace OCP\AppFramework; + use OC\AppFramework\Routing\RouteConfig; use OC\ServerContainer; use OCP\Route\IRouter; diff --git a/lib/public/AppFramework/Controller.php b/lib/public/AppFramework/Controller.php index 2e442c49768..487b6a854fe 100644 --- a/lib/public/AppFramework/Controller.php +++ b/lib/public/AppFramework/Controller.php @@ -73,7 +73,7 @@ abstract class Controller { * @since 6.0.0 - parameter $appName was added in 7.0.0 - parameter $app was removed in 7.0.0 */ public function __construct($appName, - IRequest $request) { + IRequest $request) { $this->appName = $appName; $this->request = $request; diff --git a/lib/public/AppFramework/Db/DoesNotExistException.php b/lib/public/AppFramework/Db/DoesNotExistException.php index 45008473c21..36cab24db76 100644 --- a/lib/public/AppFramework/Db/DoesNotExistException.php +++ b/lib/public/AppFramework/Db/DoesNotExistException.php @@ -27,7 +27,6 @@ declare(strict_types=1); namespace OCP\AppFramework\Db; - /** * This is returned or should be returned when a find request does not find an * entry in the database @@ -40,7 +39,7 @@ class DoesNotExistException extends \Exception implements IMapperException { * @param string $msg the error message * @since 7.0.0 */ - public function __construct($msg){ + public function __construct($msg) { parent::__construct($msg); } diff --git a/lib/public/AppFramework/Db/Entity.php b/lib/public/AppFramework/Db/Entity.php index 7340df55fc4..6221f96b375 100644 --- a/lib/public/AppFramework/Db/Entity.php +++ b/lib/public/AppFramework/Db/Entity.php @@ -25,7 +25,6 @@ namespace OCP\AppFramework\Db; - use function lcfirst; use function substr; @@ -66,7 +65,7 @@ abstract class Entity { * @param array $row the row to map onto the entity * @since 7.0.0 */ - public static function fromRow(array $row){ + public static function fromRow(array $row) { $instance = new static(); foreach($row as $key => $value){ @@ -94,7 +93,7 @@ abstract class Entity { * Marks the entity as clean needed for setting the id after the insertion * @since 7.0.0 */ - public function resetUpdatedFields(){ + public function resetUpdatedFields() { $this->_updatedFields = []; } @@ -176,7 +175,7 @@ abstract class Entity { * @param string $attribute the name of the attribute * @since 7.0.0 */ - protected function markFieldUpdated($attribute){ + protected function markFieldUpdated($attribute) { $this->_updatedFields[$attribute] = true; } @@ -187,7 +186,7 @@ abstract class Entity { * @return string the property name * @since 7.0.0 */ - public function columnToProperty($columnName){ + public function columnToProperty($columnName) { $parts = explode('_', $columnName); $property = null; @@ -209,7 +208,7 @@ abstract class Entity { * @return string the column name * @since 7.0.0 */ - public function propertyToColumn($property){ + public function propertyToColumn($property) { $parts = preg_split('/(?=[A-Z])/', $property); $column = null; @@ -229,7 +228,7 @@ abstract class Entity { * @return array array of updated fields for update query * @since 7.0.0 */ - public function getUpdatedFields(){ + public function getUpdatedFields() { return $this->_updatedFields; } @@ -241,7 +240,7 @@ abstract class Entity { * @param string $type the type which will be used to call settype() * @since 7.0.0 */ - protected function addType($fieldName, $type){ + protected function addType($fieldName, $type) { $this->_fieldTypes[$fieldName] = $type; } @@ -253,7 +252,7 @@ abstract class Entity { * @return string slugified value * @since 7.0.0 */ - public function slugify($attributeName){ + public function slugify($attributeName) { // toSlug should only work for existing attributes if(property_exists($this, $attributeName)){ $value = $this->$attributeName; diff --git a/lib/public/AppFramework/Db/Mapper.php b/lib/public/AppFramework/Db/Mapper.php index 7dcc4a4bade..289ac1d684d 100644 --- a/lib/public/AppFramework/Db/Mapper.php +++ b/lib/public/AppFramework/Db/Mapper.php @@ -49,7 +49,7 @@ abstract class Mapper { * @since 7.0.0 * @deprecated 14.0.0 Move over to QBMapper */ - public function __construct(IDBConnection $db, $tableName, $entityClass=null){ + public function __construct(IDBConnection $db, $tableName, $entityClass=null) { $this->db = $db; $this->tableName = '*PREFIX*' . $tableName; @@ -68,7 +68,7 @@ abstract class Mapper { * @since 7.0.0 * @deprecated 14.0.0 Move over to QBMapper */ - public function getTableName(){ + public function getTableName() { return $this->tableName; } @@ -80,7 +80,7 @@ abstract class Mapper { * @since 7.0.0 - return value added in 8.1.0 * @deprecated 14.0.0 Move over to QBMapper */ - public function delete(Entity $entity){ + public function delete(Entity $entity) { $sql = 'DELETE FROM `' . $this->tableName . '` WHERE `id` = ?'; $stmt = $this->execute($sql, [$entity->getId()]); $stmt->closeCursor(); @@ -95,7 +95,7 @@ abstract class Mapper { * @since 7.0.0 * @deprecated 14.0.0 Move over to QBMapper */ - public function insert(Entity $entity){ + public function insert(Entity $entity) { // get updated fields to save, fields have to be set using a setter to // be saved $properties = $entity->getUpdatedFields(); @@ -145,7 +145,7 @@ abstract class Mapper { * @since 7.0.0 - return value was added in 8.0.0 * @deprecated 14.0.0 Move over to QBMapper */ - public function update(Entity $entity){ + public function update(Entity $entity) { // if entity wasn't changed it makes no sense to run a db query $properties = $entity->getUpdatedFields(); if(count($properties) === 0) { @@ -235,7 +235,7 @@ abstract class Mapper { * @since 7.0.0 * @deprecated 14.0.0 Move over to QBMapper */ - protected function execute($sql, array $params=[], $limit=null, $offset=null){ + protected function execute($sql, array $params=[], $limit=null, $offset=null) { $query = $this->db->prepare($sql, $limit, $offset); if ($this->isAssocArray($params)) { @@ -271,7 +271,7 @@ abstract class Mapper { * @since 7.0.0 * @deprecated 14.0.0 Move over to QBMapper */ - protected function findOneQuery($sql, array $params=[], $limit=null, $offset=null){ + protected function findOneQuery($sql, array $params=[], $limit=null, $offset=null) { $stmt = $this->execute($sql, $params, $limit, $offset); $row = $stmt->fetch(); @@ -285,7 +285,7 @@ abstract class Mapper { $row2 = $stmt->fetch(); $stmt->closeCursor(); //MDB2 returns null, PDO and doctrine false when no row is available - if( ! ($row2 === false || $row2 === null )) { + if(! ($row2 === false || $row2 === null)) { $msg = $this->buildDebugMessage( 'Did not expect more than one result when executing', $sql, $params, $limit, $offset ); @@ -367,7 +367,7 @@ abstract class Mapper { * @since 7.0.0 * @deprecated 14.0.0 Move over to QBMapper */ - protected function findEntity($sql, array $params=[], $limit=null, $offset=null){ + protected function findEntity($sql, array $params=[], $limit=null, $offset=null) { return $this->mapRowToEntity($this->findOneQuery($sql, $params, $limit, $offset)); } diff --git a/lib/public/AppFramework/Db/MultipleObjectsReturnedException.php b/lib/public/AppFramework/Db/MultipleObjectsReturnedException.php index 0f37d16cffc..a3f211194c4 100644 --- a/lib/public/AppFramework/Db/MultipleObjectsReturnedException.php +++ b/lib/public/AppFramework/Db/MultipleObjectsReturnedException.php @@ -27,7 +27,6 @@ declare(strict_types=1); namespace OCP\AppFramework\Db; - /** * This is returned or should be returned when a find request finds more than one * row @@ -40,7 +39,7 @@ class MultipleObjectsReturnedException extends \Exception implements IMapperExce * @param string $msg the error message * @since 7.0.0 */ - public function __construct($msg){ + public function __construct($msg) { parent::__construct($msg); } diff --git a/lib/public/AppFramework/Db/QBMapper.php b/lib/public/AppFramework/Db/QBMapper.php index 487128b7305..c7b4b877651 100644 --- a/lib/public/AppFramework/Db/QBMapper.php +++ b/lib/public/AppFramework/Db/QBMapper.php @@ -58,7 +58,7 @@ abstract class QBMapper { * mapped to queries without using sql * @since 14.0.0 */ - public function __construct(IDBConnection $db, string $tableName, string $entityClass=null){ + public function __construct(IDBConnection $db, string $tableName, string $entityClass=null) { $this->db = $db; $this->tableName = $tableName; @@ -261,7 +261,7 @@ abstract class QBMapper { $row2 = $cursor->fetch(); $cursor->closeCursor(); - if($row2 !== false ) { + if($row2 !== false) { $msg = $this->buildDebugMessage( 'Did not expect more than one result when executing', $query ); diff --git a/lib/public/AppFramework/Http/DataDisplayResponse.php b/lib/public/AppFramework/Http/DataDisplayResponse.php index 512e52ee9fc..8e14b231522 100644 --- a/lib/public/AppFramework/Http/DataDisplayResponse.php +++ b/lib/public/AppFramework/Http/DataDisplayResponse.php @@ -48,7 +48,7 @@ class DataDisplayResponse extends Response { * @since 8.1.0 */ public function __construct($data='', $statusCode=Http::STATUS_OK, - $headers=[]) { + $headers=[]) { parent::__construct(); $this->data = $data; @@ -73,7 +73,7 @@ class DataDisplayResponse extends Response { * @return DataDisplayResponse Reference to this object * @since 8.1.0 */ - public function setData($data){ + public function setData($data) { $this->data = $data; return $this; @@ -85,7 +85,7 @@ class DataDisplayResponse extends Response { * @return string the data * @since 8.1.0 */ - public function getData(){ + public function getData() { return $this->data; } diff --git a/lib/public/AppFramework/Http/DataResponse.php b/lib/public/AppFramework/Http/DataResponse.php index 700fe1f418b..a978df49010 100644 --- a/lib/public/AppFramework/Http/DataResponse.php +++ b/lib/public/AppFramework/Http/DataResponse.php @@ -53,7 +53,7 @@ class DataResponse extends Response { * @since 8.0.0 */ public function __construct($data=[], $statusCode=Http::STATUS_OK, - array $headers=[]) { + array $headers=[]) { parent::__construct(); $this->data = $data; @@ -68,7 +68,7 @@ class DataResponse extends Response { * @return DataResponse Reference to this object * @since 8.0.0 */ - public function setData($data){ + public function setData($data) { $this->data = $data; return $this; @@ -80,7 +80,7 @@ class DataResponse extends Response { * @return array the data * @since 8.0.0 */ - public function getData(){ + public function getData() { return $this->data; } diff --git a/lib/public/AppFramework/Http/DownloadResponse.php b/lib/public/AppFramework/Http/DownloadResponse.php index 2f808ff156c..c28550a0bbd 100644 --- a/lib/public/AppFramework/Http/DownloadResponse.php +++ b/lib/public/AppFramework/Http/DownloadResponse.php @@ -25,7 +25,6 @@ namespace OCP\AppFramework\Http; - /** * Prompts the user to download the a file * @since 7.0.0 diff --git a/lib/public/AppFramework/Http/ICallbackResponse.php b/lib/public/AppFramework/Http/ICallbackResponse.php index f12a406120a..ca2f5f424ff 100644 --- a/lib/public/AppFramework/Http/ICallbackResponse.php +++ b/lib/public/AppFramework/Http/ICallbackResponse.php @@ -25,7 +25,6 @@ namespace OCP\AppFramework\Http; - /** * Interface ICallbackResponse * diff --git a/lib/public/AppFramework/Http/IOutput.php b/lib/public/AppFramework/Http/IOutput.php index 082e5e40046..83d65857c16 100644 --- a/lib/public/AppFramework/Http/IOutput.php +++ b/lib/public/AppFramework/Http/IOutput.php @@ -26,7 +26,6 @@ namespace OCP\AppFramework\Http; - /** * Very thin wrapper class to make output testable * @since 8.1.0 diff --git a/lib/public/AppFramework/Http/JSONResponse.php b/lib/public/AppFramework/Http/JSONResponse.php index 9451ef6677e..1d7a626d5cd 100644 --- a/lib/public/AppFramework/Http/JSONResponse.php +++ b/lib/public/AppFramework/Http/JSONResponse.php @@ -86,7 +86,7 @@ class JSONResponse extends Response { * @return JSONResponse Reference to this object * @since 6.0.0 - return value was added in 7.0.0 */ - public function setData($data){ + public function setData($data) { $this->data = $data; return $this; @@ -98,7 +98,7 @@ class JSONResponse extends Response { * @return array the data * @since 6.0.0 */ - public function getData(){ + public function getData() { return $this->data; } diff --git a/lib/public/AppFramework/Http/RedirectToDefaultAppResponse.php b/lib/public/AppFramework/Http/RedirectToDefaultAppResponse.php index b34ede45dfd..9072ca8a059 100644 --- a/lib/public/AppFramework/Http/RedirectToDefaultAppResponse.php +++ b/lib/public/AppFramework/Http/RedirectToDefaultAppResponse.php @@ -27,7 +27,6 @@ declare(strict_types=1); namespace OCP\AppFramework\Http; - /** * Redirects to the default app * @since 16.0.0 diff --git a/lib/public/AppFramework/Http/Response.php b/lib/public/AppFramework/Http/Response.php index 2fc985aabfb..0aacc2f3a58 100644 --- a/lib/public/AppFramework/Http/Response.php +++ b/lib/public/AppFramework/Http/Response.php @@ -198,8 +198,8 @@ class Response { */ public function addHeader($name, $value) { $name = trim($name); // always remove leading and trailing whitespace - // to be able to reliably check for security - // headers + // to be able to reliably check for security + // headers if(is_null($value)) { unset($this->headers[$name]); diff --git a/lib/public/AppFramework/Http/StreamResponse.php b/lib/public/AppFramework/Http/StreamResponse.php index 80985ae7527..a228ed5566c 100644 --- a/lib/public/AppFramework/Http/StreamResponse.php +++ b/lib/public/AppFramework/Http/StreamResponse.php @@ -42,7 +42,7 @@ class StreamResponse extends Response implements ICallbackResponse { * @param string|resource $filePath the path to the file or a file handle which should be streamed * @since 8.1.0 */ - public function __construct ($filePath) { + public function __construct($filePath) { parent::__construct(); $this->filePath = $filePath; @@ -55,7 +55,7 @@ class StreamResponse extends Response implements ICallbackResponse { * @param IOutput $output a small wrapper that handles output * @since 8.1.0 */ - public function callback (IOutput $output) { + public function callback(IOutput $output) { // handle caching if ($output->getHttpResponseCode() !== Http::STATUS_NOT_MODIFIED) { if (!(is_resource($this->filePath) || file_exists($this->filePath))) { diff --git a/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php b/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php index 9965ca6bd33..67fe6165eef 100644 --- a/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php +++ b/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php @@ -98,7 +98,7 @@ class PublicTemplateResponse extends TemplateResponse { } $this->headerActions[] = $action; } - usort($this->headerActions, function(IMenuAction $a, IMenuAction $b) { + usort($this->headerActions, function (IMenuAction $a, IMenuAction $b) { return $a->getPriority() > $b->getPriority(); }); } diff --git a/lib/public/AppFramework/Http/TemplateResponse.php b/lib/public/AppFramework/Http/TemplateResponse.php index 4a77d4844ed..504b4af93ff 100644 --- a/lib/public/AppFramework/Http/TemplateResponse.php +++ b/lib/public/AppFramework/Http/TemplateResponse.php @@ -33,7 +33,6 @@ namespace OCP\AppFramework\Http; - /** * Response for a normal template * @since 6.0.0 @@ -77,7 +76,7 @@ class TemplateResponse extends Response { * @since 6.0.0 - parameters $params and $renderAs were added in 7.0.0 */ public function __construct($appName, $templateName, array $params=[], - $renderAs='user') { + $renderAs='user') { parent::__construct(); $this->templateName = $templateName; @@ -97,7 +96,7 @@ class TemplateResponse extends Response { * @return TemplateResponse Reference to this object * @since 6.0.0 - return value was added in 7.0.0 */ - public function setParams(array $params){ + public function setParams(array $params) { $this->params = $params; return $this; @@ -109,7 +108,7 @@ class TemplateResponse extends Response { * @return array the params * @since 6.0.0 */ - public function getParams(){ + public function getParams() { return $this->params; } @@ -119,7 +118,7 @@ class TemplateResponse extends Response { * @return string the name of the used template * @since 6.0.0 */ - public function getTemplateName(){ + public function getTemplateName() { return $this->templateName; } @@ -133,7 +132,7 @@ class TemplateResponse extends Response { * @return TemplateResponse Reference to this object * @since 6.0.0 - return value was added in 7.0.0 */ - public function renderAs($renderAs){ + public function renderAs($renderAs) { $this->renderAs = $renderAs; return $this; @@ -145,7 +144,7 @@ class TemplateResponse extends Response { * @return string the renderAs value * @since 6.0.0 */ - public function getRenderAs(){ + public function getRenderAs() { return $this->renderAs; } @@ -155,7 +154,7 @@ class TemplateResponse extends Response { * @return string the rendered html * @since 6.0.0 */ - public function render(){ + public function render() { // \OCP\Template needs an empty string instead of 'blank' for an unwrapped response $renderAs = $this->renderAs === 'blank' ? '' : $this->renderAs; diff --git a/lib/public/AppFramework/Middleware.php b/lib/public/AppFramework/Middleware.php index 5df8a919efe..2cf27fc14fd 100644 --- a/lib/public/AppFramework/Middleware.php +++ b/lib/public/AppFramework/Middleware.php @@ -52,7 +52,7 @@ abstract class Middleware { * the controller * @since 6.0.0 */ - public function beforeController($controller, $methodName){ + public function beforeController($controller, $methodName) { } @@ -72,7 +72,7 @@ abstract class Middleware { * @return Response a Response object in case that the exception was handled * @since 6.0.0 */ - public function afterException($controller, $methodName, \Exception $exception){ + public function afterException($controller, $methodName, \Exception $exception) { throw $exception; } @@ -88,7 +88,7 @@ abstract class Middleware { * @return Response a Response object * @since 6.0.0 */ - public function afterController($controller, $methodName, Response $response){ + public function afterController($controller, $methodName, Response $response) { return $response; } @@ -104,7 +104,7 @@ abstract class Middleware { * @return string the output that should be printed * @since 6.0.0 */ - public function beforeOutput($controller, $methodName, $output){ + public function beforeOutput($controller, $methodName, $output) { return $output; } diff --git a/lib/public/AppFramework/OCSController.php b/lib/public/AppFramework/OCSController.php index 4a3fa882577..d7243bb4d68 100644 --- a/lib/public/AppFramework/OCSController.php +++ b/lib/public/AppFramework/OCSController.php @@ -63,7 +63,7 @@ abstract class OCSController extends ApiController { IRequest $request, $corsMethods='PUT, POST, GET, DELETE, PATCH', $corsAllowedHeaders='Authorization, Content-Type, Accept', - $corsMaxAge=1728000){ + $corsMaxAge=1728000) { parent::__construct($appName, $request, $corsMethods, $corsAllowedHeaders, $corsMaxAge); $this->registerResponder('json', function ($data) { diff --git a/lib/public/AppFramework/Utility/ITimeFactory.php b/lib/public/AppFramework/Utility/ITimeFactory.php index 08266ec775d..2ab10986f19 100644 --- a/lib/public/AppFramework/Utility/ITimeFactory.php +++ b/lib/public/AppFramework/Utility/ITimeFactory.php @@ -27,7 +27,6 @@ declare(strict_types=1); namespace OCP\AppFramework\Utility; - /** * Needed to mock calls to time() * @since 8.0.0 diff --git a/lib/public/Authentication/Events/LoginFailedEvent.php b/lib/public/Authentication/Events/LoginFailedEvent.php index 15c8fb31bce..ba5a54efb45 100644 --- a/lib/public/Authentication/Events/LoginFailedEvent.php +++ b/lib/public/Authentication/Events/LoginFailedEvent.php @@ -1,4 +1,5 @@ <?php + declare(strict_types=1); /** * @copyright Copyright (c) 2020, Roeland Jago Douma <roeland@famdouma.nl> diff --git a/lib/public/Authentication/TwoFactorAuth/IRegistry.php b/lib/public/Authentication/TwoFactorAuth/IRegistry.php index 9c10e86b5f8..70026ca1dad 100644 --- a/lib/public/Authentication/TwoFactorAuth/IRegistry.php +++ b/lib/public/Authentication/TwoFactorAuth/IRegistry.php @@ -31,7 +31,7 @@ use OCP\IUser; /** * Nextcloud 2FA provider registry for stateful 2FA providers - * + * * This service keeps track of which providers are currently active for a specific * user. Stateful 2FA providers (IStatefulProvider) must use this service to save * their enabled/disabled state. diff --git a/lib/public/BackgroundJob/IJob.php b/lib/public/BackgroundJob/IJob.php index 719d0ea013a..d1d763fd5e4 100644 --- a/lib/public/BackgroundJob/IJob.php +++ b/lib/public/BackgroundJob/IJob.php @@ -24,6 +24,7 @@ */ namespace OCP\BackgroundJob; + use OCP\ILogger; /** diff --git a/lib/public/BackgroundJob/Job.php b/lib/public/BackgroundJob/Job.php index b5b920338df..803a06ae176 100644 --- a/lib/public/BackgroundJob/Job.php +++ b/lib/public/BackgroundJob/Job.php @@ -60,7 +60,7 @@ abstract class Job implements IJob { /** * The function to prepare the execution of the job. - + * * * @param IJobList $jobList * @param ILogger|null $logger diff --git a/lib/public/Calendar/Resource/IBackend.php b/lib/public/Calendar/Resource/IBackend.php index 416643919ec..474d5f902ee 100644 --- a/lib/public/Calendar/Resource/IBackend.php +++ b/lib/public/Calendar/Resource/IBackend.php @@ -22,6 +22,7 @@ */ namespace OCP\Calendar\Resource; + use OCP\Calendar\BackendTemporarilyUnavailableException; /** diff --git a/lib/public/Calendar/Room/IBackend.php b/lib/public/Calendar/Room/IBackend.php index 00f8b64a41e..d0d3e70dc17 100644 --- a/lib/public/Calendar/Room/IBackend.php +++ b/lib/public/Calendar/Room/IBackend.php @@ -22,6 +22,7 @@ */ namespace OCP\Calendar\Room; + use OCP\Calendar\BackendTemporarilyUnavailableException; /** diff --git a/lib/public/Collaboration/AutoComplete/AutoCompleteEvent.php b/lib/public/Collaboration/AutoComplete/AutoCompleteEvent.php index cd711ea20b2..6b46d9157de 100644 --- a/lib/public/Collaboration/AutoComplete/AutoCompleteEvent.php +++ b/lib/public/Collaboration/AutoComplete/AutoCompleteEvent.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCP\Collaboration\AutoComplete; - use Symfony\Component\EventDispatcher\GenericEvent; /** diff --git a/lib/public/Collaboration/Resources/ResourceException.php b/lib/public/Collaboration/Resources/ResourceException.php index 81bace8f085..8aa72447c95 100644 --- a/lib/public/Collaboration/Resources/ResourceException.php +++ b/lib/public/Collaboration/Resources/ResourceException.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCP\Collaboration\Resources; - /** * @since 16.0.0 */ diff --git a/lib/public/Contacts/IManager.php b/lib/public/Contacts/IManager.php index 45baa127eee..dcb4c7ddbb3 100644 --- a/lib/public/Contacts/IManager.php +++ b/lib/public/Contacts/IManager.php @@ -160,7 +160,7 @@ interface IManager { /** * Return a list of the user's addressbooks display names - * + * * @return array * @since 6.0.0 * @deprecated 16.0.0 - Use `$this->getUserAddressBooks()` instead @@ -169,7 +169,7 @@ interface IManager { /** * Return a list of the user's addressbooks - * + * * @return IAddressBook[] * @since 16.0.0 */ @@ -177,7 +177,7 @@ interface IManager { /** * removes all registered address book instances - * + * * @return void * @since 6.0.0 */ diff --git a/lib/public/DB/QueryBuilder/IExpressionBuilder.php b/lib/public/DB/QueryBuilder/IExpressionBuilder.php index 1db98ba98f4..5f17585a131 100644 --- a/lib/public/DB/QueryBuilder/IExpressionBuilder.php +++ b/lib/public/DB/QueryBuilder/IExpressionBuilder.php @@ -25,7 +25,6 @@ namespace OCP\DB\QueryBuilder; - use Doctrine\DBAL\Query\Expression\ExpressionBuilder; /** diff --git a/lib/public/DB/QueryBuilder/IQueryBuilder.php b/lib/public/DB/QueryBuilder/IQueryBuilder.php index ece5d36c3eb..d65872388f9 100644 --- a/lib/public/DB/QueryBuilder/IQueryBuilder.php +++ b/lib/public/DB/QueryBuilder/IQueryBuilder.php @@ -26,7 +26,6 @@ namespace OCP\DB\QueryBuilder; - use Doctrine\DBAL\Connection; /** diff --git a/lib/public/Dashboard/IDashboardManager.php b/lib/public/Dashboard/IDashboardManager.php index 683ead5512e..7805bc236e8 100644 --- a/lib/public/Dashboard/IDashboardManager.php +++ b/lib/public/Dashboard/IDashboardManager.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCP\Dashboard; - use OCP\Dashboard\Exceptions\DashboardAppNotAvailableException; use OCP\Dashboard\Model\IWidgetConfig; use OCP\Dashboard\Service\IEventsService; diff --git a/lib/public/Dashboard/IDashboardWidget.php b/lib/public/Dashboard/IDashboardWidget.php index 8532a8700a1..9010845355a 100644 --- a/lib/public/Dashboard/IDashboardWidget.php +++ b/lib/public/Dashboard/IDashboardWidget.php @@ -27,7 +27,6 @@ declare(strict_types=1); namespace OCP\Dashboard; - use OCP\Dashboard\Model\IWidgetConfig; use OCP\Dashboard\Model\IWidgetRequest; use OCP\Dashboard\Model\WidgetSetup; diff --git a/lib/public/Dashboard/Model/IWidgetConfig.php b/lib/public/Dashboard/Model/IWidgetConfig.php index 7d3d88f3241..bc33b37f544 100644 --- a/lib/public/Dashboard/Model/IWidgetConfig.php +++ b/lib/public/Dashboard/Model/IWidgetConfig.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCP\Dashboard\Model; - use OCP\Dashboard\IDashboardWidget; /** diff --git a/lib/public/Dashboard/Model/IWidgetRequest.php b/lib/public/Dashboard/Model/IWidgetRequest.php index 0a49e34ab30..b646935978a 100644 --- a/lib/public/Dashboard/Model/IWidgetRequest.php +++ b/lib/public/Dashboard/Model/IWidgetRequest.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCP\Dashboard\Model; - use OCP\Dashboard\IDashboardWidget; /** diff --git a/lib/public/Dashboard/Model/WidgetSetting.php b/lib/public/Dashboard/Model/WidgetSetting.php index 29744c56fac..b20d8d68b38 100644 --- a/lib/public/Dashboard/Model/WidgetSetting.php +++ b/lib/public/Dashboard/Model/WidgetSetting.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCP\Dashboard\Model; - use JsonSerializable; /** diff --git a/lib/public/Dashboard/Model/WidgetSetup.php b/lib/public/Dashboard/Model/WidgetSetup.php index 4d9884fd470..80885705633 100644 --- a/lib/public/Dashboard/Model/WidgetSetup.php +++ b/lib/public/Dashboard/Model/WidgetSetup.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCP\Dashboard\Model; - use JsonSerializable; /** diff --git a/lib/public/Dashboard/Model/WidgetTemplate.php b/lib/public/Dashboard/Model/WidgetTemplate.php index ba4447638a1..979a49a342d 100644 --- a/lib/public/Dashboard/Model/WidgetTemplate.php +++ b/lib/public/Dashboard/Model/WidgetTemplate.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCP\Dashboard\Model; - use JsonSerializable; /** diff --git a/lib/public/Dashboard/Service/IEventsService.php b/lib/public/Dashboard/Service/IEventsService.php index a036149599c..a9898f578e6 100644 --- a/lib/public/Dashboard/Service/IEventsService.php +++ b/lib/public/Dashboard/Service/IEventsService.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCP\Dashboard\Service; - use OCP\Dashboard\IDashboardManager; /** diff --git a/lib/public/Dashboard/Service/IWidgetsService.php b/lib/public/Dashboard/Service/IWidgetsService.php index 73a0bd7b171..dfa89ec1f59 100644 --- a/lib/public/Dashboard/Service/IWidgetsService.php +++ b/lib/public/Dashboard/Service/IWidgetsService.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCP\Dashboard\Service; - use OCP\Dashboard\Model\IWidgetConfig; /** diff --git a/lib/public/Diagnostics/IQueryLogger.php b/lib/public/Diagnostics/IQueryLogger.php index 14628c5688f..5a5656a6bca 100644 --- a/lib/public/Diagnostics/IQueryLogger.php +++ b/lib/public/Diagnostics/IQueryLogger.php @@ -35,10 +35,10 @@ use Doctrine\DBAL\Logging\SQLLogger; */ interface IQueryLogger extends SQLLogger { /** - * Mark the start of a query providing query SQL statement, its parameters and types. - * This method should be called as close to the DB as possible and after - * query is finished finalized with stopQuery() method. - * + * Mark the start of a query providing query SQL statement, its parameters and types. + * This method should be called as close to the DB as possible and after + * query is finished finalized with stopQuery() method. + * * @param string $sql * @param array|null $params * @param array|null $types @@ -49,7 +49,7 @@ interface IQueryLogger extends SQLLogger { /** * Mark the end of the current active query. Ending query should store \OCP\Diagnostics\IQuery to * be returned with getQueries() method. - * + * * @return mixed * @since 8.0.0 */ @@ -58,7 +58,7 @@ interface IQueryLogger extends SQLLogger { /** * This method should return all \OCP\Diagnostics\IQuery objects stored using * startQuery()/stopQuery() methods. - * + * * @return \OCP\Diagnostics\IQuery[] * @since 8.0.0 */ @@ -67,8 +67,8 @@ interface IQueryLogger extends SQLLogger { /** * Activate the module for the duration of the request. Deactivated module * does not create and store \OCP\Diagnostics\IQuery objects. - * Only activated module should create and store objects to be - * returned with getQueries() call. + * Only activated module should create and store objects to be + * returned with getQueries() call. * * @since 12.0.0 */ diff --git a/lib/public/DirectEditing/ACreateEmpty.php b/lib/public/DirectEditing/ACreateEmpty.php index 022bccf9516..71a18c94e23 100644 --- a/lib/public/DirectEditing/ACreateEmpty.php +++ b/lib/public/DirectEditing/ACreateEmpty.php @@ -23,7 +23,6 @@ namespace OCP\DirectEditing; - use OCP\Files\File; /** diff --git a/lib/public/DirectEditing/IEditor.php b/lib/public/DirectEditing/IEditor.php index 5b376ba2ad5..22ec130aee0 100644 --- a/lib/public/DirectEditing/IEditor.php +++ b/lib/public/DirectEditing/IEditor.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCP\DirectEditing; - use OCP\AppFramework\Http\Response; /** diff --git a/lib/public/DirectEditing/IManager.php b/lib/public/DirectEditing/IManager.php index 33d4716fc60..e9548a91e7a 100644 --- a/lib/public/DirectEditing/IManager.php +++ b/lib/public/DirectEditing/IManager.php @@ -87,4 +87,3 @@ interface IManager { public function cleanup(): int; } - diff --git a/lib/public/DirectEditing/IToken.php b/lib/public/DirectEditing/IToken.php index 416b2ccb807..46c423053fe 100644 --- a/lib/public/DirectEditing/IToken.php +++ b/lib/public/DirectEditing/IToken.php @@ -23,7 +23,6 @@ namespace OCP\DirectEditing; - use OCP\Files\File; use OCP\Files\NotFoundException; diff --git a/lib/public/Encryption/Exceptions/GenericEncryptionException.php b/lib/public/Encryption/Exceptions/GenericEncryptionException.php index 938e6662a79..2124e5effea 100644 --- a/lib/public/Encryption/Exceptions/GenericEncryptionException.php +++ b/lib/public/Encryption/Exceptions/GenericEncryptionException.php @@ -25,6 +25,7 @@ */ namespace OCP\Encryption\Exceptions; + use OC\HintException; /** diff --git a/lib/public/Encryption/IEncryptionModule.php b/lib/public/Encryption/IEncryptionModule.php index 90d427d4a1a..9646fb90e93 100644 --- a/lib/public/Encryption/IEncryptionModule.php +++ b/lib/public/Encryption/IEncryptionModule.php @@ -25,6 +25,7 @@ */ namespace OCP\Encryption; + use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; diff --git a/lib/public/Files.php b/lib/public/Files.php index 1e6e9d48e03..a1ff8a6d5a9 100644 --- a/lib/public/Files.php +++ b/lib/public/Files.php @@ -54,8 +54,8 @@ class Files { * @since 5.0.0 * @deprecated 14.0.0 */ - static public function rmdirr( $dir ) { - return \OC_Helper::rmdirr( $dir ); + static public function rmdirr($dir) { + return \OC_Helper::rmdirr($dir); } /** @@ -66,7 +66,7 @@ class Files { * @since 5.0.0 * @deprecated 14.0.0 */ - static public function getMimeType( $path ) { + static public function getMimeType($path) { return \OC::$server->getMimeTypeDetector()->detect($path); } @@ -89,8 +89,8 @@ class Files { * @since 5.0.0 * @deprecated 14.0.0 */ - public static function streamCopy( $source, $target ) { - list($count, ) = \OC_Helper::streamCopy( $source, $target ); + public static function streamCopy($source, $target) { + list($count, ) = \OC_Helper::streamCopy($source, $target); return $count; } @@ -115,6 +115,6 @@ class Files { * @deprecated 14.0.0 use IAppData instead */ public static function getStorage($app) { - return \OC_App::getStorage( $app ); + return \OC_App::getStorage($app); } } diff --git a/lib/public/Files/Cache/ICache.php b/lib/public/Files/Cache/ICache.php index a4c9bfe3e45..d1388f02b1d 100644 --- a/lib/public/Files/Cache/ICache.php +++ b/lib/public/Files/Cache/ICache.php @@ -21,6 +21,7 @@ */ namespace OCP\Files\Cache; + use OCP\Files\Search\ISearchQuery; /** diff --git a/lib/public/Files/Folder.php b/lib/public/Files/Folder.php index a78a9ca8f78..4c05b0fb490 100644 --- a/lib/public/Files/Folder.php +++ b/lib/public/Files/Folder.php @@ -32,6 +32,7 @@ // This means that they should be used by apps instead of the internal ownCloud classes namespace OCP\Files; + use OCP\Files\Search\ISearchQuery; /** diff --git a/lib/public/Files/IMimeTypeDetector.php b/lib/public/Files/IMimeTypeDetector.php index ec80b3480d1..bb75ce742c5 100644 --- a/lib/public/Files/IMimeTypeDetector.php +++ b/lib/public/Files/IMimeTypeDetector.php @@ -26,7 +26,6 @@ namespace OCP\Files; - /** * Interface IMimeTypeDetector * @package OCP\Files diff --git a/lib/public/Files/Storage/IStorageFactory.php b/lib/public/Files/Storage/IStorageFactory.php index e5a94de34f9..e9550fdaa29 100644 --- a/lib/public/Files/Storage/IStorageFactory.php +++ b/lib/public/Files/Storage/IStorageFactory.php @@ -23,6 +23,7 @@ */ namespace OCP\Files\Storage; + use OCP\Files\Mount\IMountPoint; /** diff --git a/lib/public/Files/StorageNotAvailableException.php b/lib/public/Files/StorageNotAvailableException.php index 0b1defaded8..052a6b5ad78 100644 --- a/lib/public/Files/StorageNotAvailableException.php +++ b/lib/public/Files/StorageNotAvailableException.php @@ -36,6 +36,7 @@ // This means that they should be used by apps instead of the internal ownCloud classes namespace OCP\Files; + use OC\HintException; /** diff --git a/lib/public/Files_FullTextSearch/Model/AFilesDocument.php b/lib/public/Files_FullTextSearch/Model/AFilesDocument.php index 24c14089bcc..1ca6bff98c9 100644 --- a/lib/public/Files_FullTextSearch/Model/AFilesDocument.php +++ b/lib/public/Files_FullTextSearch/Model/AFilesDocument.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCP\Files_FullTextSearch\Model; - use OC\FullTextSearch\Model\IndexDocument; use OCP\FullTextSearch\Model\IIndexDocument; diff --git a/lib/public/FullTextSearch/IFullTextSearchManager.php b/lib/public/FullTextSearch/IFullTextSearchManager.php index 8730a344ded..e420e91f3a1 100644 --- a/lib/public/FullTextSearch/IFullTextSearchManager.php +++ b/lib/public/FullTextSearch/IFullTextSearchManager.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCP\FullTextSearch; - use OCP\FullTextSearch\Model\IIndex; use OCP\FullTextSearch\Model\ISearchResult; use OCP\FullTextSearch\Service\IIndexService; diff --git a/lib/public/FullTextSearch/IFullTextSearchPlatform.php b/lib/public/FullTextSearch/IFullTextSearchPlatform.php index a22e6930383..797c179082e 100644 --- a/lib/public/FullTextSearch/IFullTextSearchPlatform.php +++ b/lib/public/FullTextSearch/IFullTextSearchPlatform.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCP\FullTextSearch; - use OCP\FullTextSearch\Model\IDocumentAccess; use OCP\FullTextSearch\Model\IIndex; use OCP\FullTextSearch\Model\IIndexDocument; diff --git a/lib/public/FullTextSearch/IFullTextSearchProvider.php b/lib/public/FullTextSearch/IFullTextSearchProvider.php index f9a56b40e85..4a37001754a 100644 --- a/lib/public/FullTextSearch/IFullTextSearchProvider.php +++ b/lib/public/FullTextSearch/IFullTextSearchProvider.php @@ -27,7 +27,6 @@ declare(strict_types=1); namespace OCP\FullTextSearch; - use OCP\FullTextSearch\Model\IIndex; use OCP\FullTextSearch\Model\IIndexDocument; use OCP\FullTextSearch\Model\IIndexOptions; diff --git a/lib/public/FullTextSearch/Model/IDocumentAccess.php b/lib/public/FullTextSearch/Model/IDocumentAccess.php index 713a018e661..478072593aa 100644 --- a/lib/public/FullTextSearch/Model/IDocumentAccess.php +++ b/lib/public/FullTextSearch/Model/IDocumentAccess.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCP\FullTextSearch\Model; - /** * Interface IDocumentAccess * diff --git a/lib/public/FullTextSearch/Model/IIndex.php b/lib/public/FullTextSearch/Model/IIndex.php index 0f3f718d7ba..7078962d99e 100644 --- a/lib/public/FullTextSearch/Model/IIndex.php +++ b/lib/public/FullTextSearch/Model/IIndex.php @@ -27,7 +27,6 @@ declare(strict_types=1); namespace OCP\FullTextSearch\Model; - /** * Interface IIndex * diff --git a/lib/public/FullTextSearch/Model/IIndexDocument.php b/lib/public/FullTextSearch/Model/IIndexDocument.php index e86582b9234..667d2c15c7f 100644 --- a/lib/public/FullTextSearch/Model/IIndexDocument.php +++ b/lib/public/FullTextSearch/Model/IIndexDocument.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCP\FullTextSearch\Model; - /** * Class IIndexDocument * diff --git a/lib/public/FullTextSearch/Model/IIndexOptions.php b/lib/public/FullTextSearch/Model/IIndexOptions.php index daa8f5a0c7a..8719289d746 100644 --- a/lib/public/FullTextSearch/Model/IIndexOptions.php +++ b/lib/public/FullTextSearch/Model/IIndexOptions.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCP\FullTextSearch\Model; - /** * Interface IIndexOptions * diff --git a/lib/public/FullTextSearch/Model/IRunner.php b/lib/public/FullTextSearch/Model/IRunner.php index c4eecfa4894..d92eb789d64 100644 --- a/lib/public/FullTextSearch/Model/IRunner.php +++ b/lib/public/FullTextSearch/Model/IRunner.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCP\FullTextSearch\Model; - /** * Interface IRunner * diff --git a/lib/public/FullTextSearch/Model/ISearchOption.php b/lib/public/FullTextSearch/Model/ISearchOption.php index bbd2ac4827a..3f893c516d9 100644 --- a/lib/public/FullTextSearch/Model/ISearchOption.php +++ b/lib/public/FullTextSearch/Model/ISearchOption.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCP\FullTextSearch\Model; - /** * @since 16.0.0 * diff --git a/lib/public/FullTextSearch/Model/ISearchRequest.php b/lib/public/FullTextSearch/Model/ISearchRequest.php index 2453c1e871c..d48b74288fd 100644 --- a/lib/public/FullTextSearch/Model/ISearchRequest.php +++ b/lib/public/FullTextSearch/Model/ISearchRequest.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCP\FullTextSearch\Model; - /** * Interface ISearchRequest * diff --git a/lib/public/FullTextSearch/Model/ISearchRequestSimpleQuery.php b/lib/public/FullTextSearch/Model/ISearchRequestSimpleQuery.php index ca11b0c9317..c72d15a6930 100644 --- a/lib/public/FullTextSearch/Model/ISearchRequestSimpleQuery.php +++ b/lib/public/FullTextSearch/Model/ISearchRequestSimpleQuery.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCP\FullTextSearch\Model; - /** * Interface ISearchRequestSimpleQuery * diff --git a/lib/public/FullTextSearch/Model/ISearchResult.php b/lib/public/FullTextSearch/Model/ISearchResult.php index 775c4314bb1..1d8cb5d8037 100644 --- a/lib/public/FullTextSearch/Model/ISearchResult.php +++ b/lib/public/FullTextSearch/Model/ISearchResult.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCP\FullTextSearch\Model; - use OCP\FullTextSearch\IFullTextSearchProvider; /** diff --git a/lib/public/FullTextSearch/Model/ISearchTemplate.php b/lib/public/FullTextSearch/Model/ISearchTemplate.php index 43d1a586a1d..b63bae43a0a 100644 --- a/lib/public/FullTextSearch/Model/ISearchTemplate.php +++ b/lib/public/FullTextSearch/Model/ISearchTemplate.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCP\FullTextSearch\Model; - use OCP\FullTextSearch\IFullTextSearchProvider; /** diff --git a/lib/public/FullTextSearch/Service/IIndexService.php b/lib/public/FullTextSearch/Service/IIndexService.php index 3c3bd4bbe1f..f660909c9ca 100644 --- a/lib/public/FullTextSearch/Service/IIndexService.php +++ b/lib/public/FullTextSearch/Service/IIndexService.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCP\FullTextSearch\Service; - use OCP\FullTextSearch\Model\IIndex; /** diff --git a/lib/public/FullTextSearch/Service/IProviderService.php b/lib/public/FullTextSearch/Service/IProviderService.php index 8d4b68e4136..50c32649357 100644 --- a/lib/public/FullTextSearch/Service/IProviderService.php +++ b/lib/public/FullTextSearch/Service/IProviderService.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCP\FullTextSearch\Service; - /** * Interface IProviderService * diff --git a/lib/public/FullTextSearch/Service/ISearchService.php b/lib/public/FullTextSearch/Service/ISearchService.php index 8c2152855a1..89fa1a444e2 100644 --- a/lib/public/FullTextSearch/Service/ISearchService.php +++ b/lib/public/FullTextSearch/Service/ISearchService.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCP\FullTextSearch\Service; - use OCP\FullTextSearch\Model\ISearchRequest; use OCP\FullTextSearch\Model\ISearchResult; diff --git a/lib/public/IDBConnection.php b/lib/public/IDBConnection.php index a7aa9d448f1..405b4ba1b04 100644 --- a/lib/public/IDBConnection.php +++ b/lib/public/IDBConnection.php @@ -38,6 +38,7 @@ // This means that they should be used by apps instead of the internal ownCloud classes namespace OCP; + use Doctrine\DBAL\Schema\Schema; use OCP\DB\QueryBuilder\IQueryBuilder; diff --git a/lib/public/ISearch.php b/lib/public/ISearch.php index bdfe8431f13..fa6fc49c976 100644 --- a/lib/public/ISearch.php +++ b/lib/public/ISearch.php @@ -27,7 +27,6 @@ namespace OCP; - /** * Small Interface for Search * @since 7.0.0 diff --git a/lib/public/IServerContainer.php b/lib/public/IServerContainer.php index 7443f32bfe3..40f8d93f350 100644 --- a/lib/public/IServerContainer.php +++ b/lib/public/IServerContainer.php @@ -47,6 +47,7 @@ // This means that they should be used by apps instead of the internal ownCloud classes namespace OCP; + use OCP\Federation\ICloudFederationFactory; use OCP\Federation\ICloudFederationProviderManager; use OCP\Log\ILogFactory; diff --git a/lib/public/ITagManager.php b/lib/public/ITagManager.php index 960ae6f2f3b..46e1ba06297 100644 --- a/lib/public/ITagManager.php +++ b/lib/public/ITagManager.php @@ -59,6 +59,6 @@ interface ITagManager { * logged in user * @return \OCP\ITags * @since 6.0.0 - parameter $includeShared and $userId were added in 8.0.0 - */ + */ public function load($type, $defaultTags = [], $includeShared = false, $userId = null); } diff --git a/lib/public/IUser.php b/lib/public/IUser.php index a5e94bf8ac4..910c1a06d9d 100644 --- a/lib/public/IUser.php +++ b/lib/public/IUser.php @@ -28,7 +28,6 @@ namespace OCP; - /** * Interface IUser * diff --git a/lib/public/IUserManager.php b/lib/public/IUserManager.php index 7985c1bd6f4..a8df1a1af7e 100644 --- a/lib/public/IUserManager.php +++ b/lib/public/IUserManager.php @@ -30,7 +30,6 @@ namespace OCP; - /** * Class Manager * @@ -50,11 +49,11 @@ namespace OCP; */ interface IUserManager { /** - * register a user backend - * - * @param \OCP\UserInterface $backend - * @since 8.0.0 - */ + * register a user backend + * + * @param \OCP\UserInterface $backend + * @since 8.0.0 + */ public function registerBackend($backend); /** diff --git a/lib/public/LDAP/ILDAPProvider.php b/lib/public/LDAP/ILDAPProvider.php index 25127987eef..491906e5556 100644 --- a/lib/public/LDAP/ILDAPProvider.php +++ b/lib/public/LDAP/ILDAPProvider.php @@ -76,7 +76,7 @@ interface ILDAPProvider { public function sanitizeDN($dn); /** - * Return a new LDAP connection resource for the specified user. + * Return a new LDAP connection resource for the specified user. * @param string $uid user id * @return resource of the LDAP connection * @since 11.0.0 diff --git a/lib/public/Lock/ManuallyLockedException.php b/lib/public/Lock/ManuallyLockedException.php index 12567456e18..1609727f4e8 100644 --- a/lib/public/Lock/ManuallyLockedException.php +++ b/lib/public/Lock/ManuallyLockedException.php @@ -27,7 +27,6 @@ declare(strict_types=1); namespace OCP\Lock; - /** * Class ManuallyLockedException * diff --git a/lib/public/Notification/AlreadyProcessedException.php b/lib/public/Notification/AlreadyProcessedException.php index 2cb1fc92765..251221004c9 100644 --- a/lib/public/Notification/AlreadyProcessedException.php +++ b/lib/public/Notification/AlreadyProcessedException.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCP\Notification; - /** * @since 17.0.0 */ diff --git a/lib/public/RichObjectStrings/Definitions.php b/lib/public/RichObjectStrings/Definitions.php index a4cf4dac725..6b293dfff6d 100644 --- a/lib/public/RichObjectStrings/Definitions.php +++ b/lib/public/RichObjectStrings/Definitions.php @@ -26,7 +26,6 @@ namespace OCP\RichObjectStrings; - /** * Class Definitions * diff --git a/lib/public/SabrePluginEvent.php b/lib/public/SabrePluginEvent.php index b04ca420e32..c9f80d184c2 100644 --- a/lib/public/SabrePluginEvent.php +++ b/lib/public/SabrePluginEvent.php @@ -25,7 +25,6 @@ namespace OCP; - use OCP\AppFramework\Http; use OCP\EventDispatcher\Event; use Sabre\DAV\Server; diff --git a/lib/public/SabrePluginException.php b/lib/public/SabrePluginException.php index 3f46885a11a..7d2220999e5 100644 --- a/lib/public/SabrePluginException.php +++ b/lib/public/SabrePluginException.php @@ -22,7 +22,6 @@ namespace OCP; - use Sabre\DAV\Exception; /** diff --git a/lib/public/Search/Result.php b/lib/public/Search/Result.php index 0cbeb114af6..8d9a4e5d237 100644 --- a/lib/public/Search/Result.php +++ b/lib/public/Search/Result.php @@ -56,7 +56,7 @@ class Result { /** * The type of search result returned; for consistency, name this the same - * as the class name (e.g. \OC\Search\File -> 'file') in lowercase. + * as the class name (e.g. \OC\Search\File -> 'file') in lowercase. * @var string * @since 7.0.0 */ diff --git a/lib/public/Security/IContentSecurityPolicyManager.php b/lib/public/Security/IContentSecurityPolicyManager.php index bd579703cad..465a8c317f6 100644 --- a/lib/public/Security/IContentSecurityPolicyManager.php +++ b/lib/public/Security/IContentSecurityPolicyManager.php @@ -22,6 +22,7 @@ */ namespace OCP\Security; + use OCP\AppFramework\Http\EmptyContentSecurityPolicy; /** diff --git a/lib/public/Security/ISecureRandom.php b/lib/public/Security/ISecureRandom.php index c2d149feaf8..3fbc6c8ee10 100644 --- a/lib/public/Security/ISecureRandom.php +++ b/lib/public/Security/ISecureRandom.php @@ -51,7 +51,7 @@ interface ISecureRandom { /** * Characters that can be used for <code>generate($length, $characters)</code>, to - * generate human readable random strings. Lower- and upper-case characters and digits + * generate human readable random strings. Lower- and upper-case characters and digits * are included. Characters which are ambiguous are excluded, such as I, l, and 1 and so on. */ const CHAR_HUMAN_READABLE = 'abcdefgijkmnopqrstwxyzABCDEFGHJKLMNPQRSTWXYZ23456789'; diff --git a/lib/public/Share.php b/lib/public/Share.php index 25e255f35ba..622a6718924 100644 --- a/lib/public/Share.php +++ b/lib/public/Share.php @@ -121,7 +121,7 @@ class Share extends \OC\Share\Constants { * @deprecated 17.0.0 */ public static function getItemShared($itemType, $itemSource, $format = self::FORMAT_NONE, - $parameters = null, $includeCollections = false) { + $parameters = null, $includeCollections = false) { return \OC\Share\Share::getItemShared($itemType, $itemSource, $format, $parameters, $includeCollections); } diff --git a/lib/public/Share/Exceptions/GenericShareException.php b/lib/public/Share/Exceptions/GenericShareException.php index b9c134b8d00..3714edbfc33 100644 --- a/lib/public/Share/Exceptions/GenericShareException.php +++ b/lib/public/Share/Exceptions/GenericShareException.php @@ -23,6 +23,7 @@ */ namespace OCP\Share\Exceptions; + use OC\HintException; /** diff --git a/lib/public/User/Backend/ABackend.php b/lib/public/User/Backend/ABackend.php index 6c691ef1fce..a57a561369b 100644 --- a/lib/public/User/Backend/ABackend.php +++ b/lib/public/User/Backend/ABackend.php @@ -3,7 +3,7 @@ declare(strict_types=1); /** -* @copyright Copyright (c) 2018 Roeland Jago Douma <roeland@famdouma.nl> + * @copyright Copyright (c) 2018 Roeland Jago Douma <roeland@famdouma.nl> * * @author Christoph Wurst <christoph@winzerhof-wurst.at> * @author Roeland Jago Douma <roeland@famdouma.nl> diff --git a/lib/public/User/Events/BeforeUserLoggedInEvent.php b/lib/public/User/Events/BeforeUserLoggedInEvent.php index dca5c16518b..3f64bf7ce3d 100644 --- a/lib/public/User/Events/BeforeUserLoggedInEvent.php +++ b/lib/public/User/Events/BeforeUserLoggedInEvent.php @@ -27,7 +27,6 @@ declare(strict_types=1); namespace OCP\User\Events; use OCP\EventDispatcher\Event; -use OCP\IUser; /** * @since 18.0.0 diff --git a/lib/public/Util.php b/lib/public/Util.php index f1008ad77c9..4427e39b24b 100644 --- a/lib/public/Util.php +++ b/lib/public/Util.php @@ -128,7 +128,7 @@ class Util { * @since 4.0.0 * @deprecated 13.0.0 use log of \OCP\ILogger */ - public static function writeLog( $app, $message, $level ) { + public static function writeLog($app, $message, $level) { $context = ['app' => $app]; \OC::$server->getLogger()->log($level, $message, $context); } @@ -170,8 +170,8 @@ class Util { * @param string $file * @since 4.0.0 */ - public static function addStyle( $application, $file = null ) { - \OC_Util::addStyle( $application, $file ); + public static function addStyle($application, $file = null) { + \OC_Util::addStyle($application, $file); } /** @@ -180,8 +180,8 @@ class Util { * @param string $file * @since 4.0.0 */ - public static function addScript( $application, $file = null ) { - \OC_Util::addScript( $application, $file ); + public static function addScript($application, $file = null) { + \OC_Util::addScript($application, $file); } /** @@ -216,7 +216,7 @@ class Util { * @return string the url * @since 4.0.0 - parameter $args was added in 4.5.0 */ - public static function linkToAbsolute( $app, $file, $args = [] ) { + public static function linkToAbsolute($app, $file, $args = []) { $urlGenerator = \OC::$server->getURLGenerator(); return $urlGenerator->getAbsoluteURL( $urlGenerator->linkTo($app, $file, $args) @@ -229,7 +229,7 @@ class Util { * @return string the url * @since 4.0.0 */ - public static function linkToRemote( $service ) { + public static function linkToRemote($service) { $urlGenerator = \OC::$server->getURLGenerator(); $remoteBase = $urlGenerator->linkTo('', 'remote.php') . '/' . $service; return $urlGenerator->getAbsoluteURL( diff --git a/lib/public/WorkflowEngine/IFileCheck.php b/lib/public/WorkflowEngine/IFileCheck.php index b94f3e512d3..d11a5011367 100644 --- a/lib/public/WorkflowEngine/IFileCheck.php +++ b/lib/public/WorkflowEngine/IFileCheck.php @@ -27,7 +27,6 @@ declare(strict_types=1); namespace OCP\WorkflowEngine; - use OCP\Files\Storage\IStorage; /** |