@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | class Manager implements IManager { |
| 31 | 31 | /** @var string[] */ |
| 32 | - protected $sorters =[]; |
|
| 32 | + protected $sorters = []; |
|
| 33 | 33 | |
| 34 | 34 | /** @var ISorter[] */ |
| 35 | 35 | protected $sorterInstances = []; |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | public function runSorters(array $sorters, array &$sortArray, array $context) { |
| 44 | 44 | $sorterInstances = $this->getSorters(); |
| 45 | - while($sorter = array_shift($sorters)) { |
|
| 46 | - if(isset($sorterInstances[$sorter])) { |
|
| 45 | + while ($sorter = array_shift($sorters)) { |
|
| 46 | + if (isset($sorterInstances[$sorter])) { |
|
| 47 | 47 | $sorterInstances[$sorter]->sort($sortArray, $context); |
| 48 | 48 | } else { |
| 49 | 49 | $this->c->getLogger()->warning('No sorter for ID "{id}", skipping', [ |
@@ -58,17 +58,17 @@ discard block |
||
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | protected function getSorters() { |
| 61 | - if(count($this->sorterInstances) === 0) { |
|
| 61 | + if (count($this->sorterInstances) === 0) { |
|
| 62 | 62 | foreach ($this->sorters as $sorter) { |
| 63 | 63 | /** @var ISorter $instance */ |
| 64 | 64 | $instance = $this->c->resolve($sorter); |
| 65 | - if(!$instance instanceof ISorter) { |
|
| 65 | + if (!$instance instanceof ISorter) { |
|
| 66 | 66 | $this->c->getLogger()->notice('Skipping sorter which is not an instance of ISorter. Class name: {class}', |
| 67 | 67 | ['app' => 'core', 'class' => $sorter]); |
| 68 | 68 | continue; |
| 69 | 69 | } |
| 70 | 70 | $sorterId = trim($instance->getId()); |
| 71 | - if(trim($sorterId) === '') { |
|
| 71 | + if (trim($sorterId) === '') { |
|
| 72 | 72 | $this->c->getLogger()->notice('Skipping sorter with empty ID. Class name: {class}', |
| 73 | 73 | ['app' => 'core', 'class' => $sorter]); |
| 74 | 74 | continue; |
@@ -6,52 +6,52 @@ |
||
| 6 | 6 | $baseDir = $vendorDir; |
| 7 | 7 | |
| 8 | 8 | return array( |
| 9 | - 'OCA\\Files_Sharing\\Activity\\Filter' => $baseDir . '/../lib/Activity/Filter.php', |
|
| 10 | - 'OCA\\Files_Sharing\\Activity\\Providers\\Base' => $baseDir . '/../lib/Activity/Providers/Base.php', |
|
| 11 | - 'OCA\\Files_Sharing\\Activity\\Providers\\Downloads' => $baseDir . '/../lib/Activity/Providers/Downloads.php', |
|
| 12 | - 'OCA\\Files_Sharing\\Activity\\Providers\\Groups' => $baseDir . '/../lib/Activity/Providers/Groups.php', |
|
| 13 | - 'OCA\\Files_Sharing\\Activity\\Providers\\PublicLinks' => $baseDir . '/../lib/Activity/Providers/PublicLinks.php', |
|
| 14 | - 'OCA\\Files_Sharing\\Activity\\Providers\\RemoteShares' => $baseDir . '/../lib/Activity/Providers/RemoteShares.php', |
|
| 15 | - 'OCA\\Files_Sharing\\Activity\\Providers\\Users' => $baseDir . '/../lib/Activity/Providers/Users.php', |
|
| 16 | - 'OCA\\Files_Sharing\\Activity\\Settings\\PublicLinks' => $baseDir . '/../lib/Activity/Settings/PublicLinks.php', |
|
| 17 | - 'OCA\\Files_Sharing\\Activity\\Settings\\RemoteShare' => $baseDir . '/../lib/Activity/Settings/RemoteShare.php', |
|
| 18 | - 'OCA\\Files_Sharing\\Activity\\Settings\\Shared' => $baseDir . '/../lib/Activity/Settings/Shared.php', |
|
| 19 | - 'OCA\\Files_Sharing\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php', |
|
| 20 | - 'OCA\\Files_Sharing\\Cache' => $baseDir . '/../lib/Cache.php', |
|
| 21 | - 'OCA\\Files_Sharing\\Capabilities' => $baseDir . '/../lib/Capabilities.php', |
|
| 22 | - 'OCA\\Files_Sharing\\Collaboration\\ShareRecipientSorter' => $baseDir . '/../lib/Collaboration/ShareRecipientSorter.php', |
|
| 23 | - 'OCA\\Files_Sharing\\Command\\CleanupRemoteStorages' => $baseDir . '/../lib/Command/CleanupRemoteStorages.php', |
|
| 24 | - 'OCA\\Files_Sharing\\Controller\\ExternalSharesController' => $baseDir . '/../lib/Controller/ExternalSharesController.php', |
|
| 25 | - 'OCA\\Files_Sharing\\Controller\\PublicPreviewController' => $baseDir . '/../lib/Controller/PublicPreviewController.php', |
|
| 26 | - 'OCA\\Files_Sharing\\Controller\\RemoteController' => $baseDir . '/../lib/Controller/RemoteController.php', |
|
| 27 | - 'OCA\\Files_Sharing\\Controller\\ShareAPIController' => $baseDir . '/../lib/Controller/ShareAPIController.php', |
|
| 28 | - 'OCA\\Files_Sharing\\Controller\\ShareController' => $baseDir . '/../lib/Controller/ShareController.php', |
|
| 29 | - 'OCA\\Files_Sharing\\Controller\\ShareInfoController' => $baseDir . '/../lib/Controller/ShareInfoController.php', |
|
| 30 | - 'OCA\\Files_Sharing\\Controller\\ShareesAPIController' => $baseDir . '/../lib/Controller/ShareesAPIController.php', |
|
| 31 | - 'OCA\\Files_Sharing\\DeleteOrphanedSharesJob' => $baseDir . '/../lib/DeleteOrphanedSharesJob.php', |
|
| 32 | - 'OCA\\Files_Sharing\\Exceptions\\BrokenPath' => $baseDir . '/../lib/Exceptions/BrokenPath.php', |
|
| 33 | - 'OCA\\Files_Sharing\\Exceptions\\S2SException' => $baseDir . '/../lib/Exceptions/S2SException.php', |
|
| 34 | - 'OCA\\Files_Sharing\\ExpireSharesJob' => $baseDir . '/../lib/ExpireSharesJob.php', |
|
| 35 | - 'OCA\\Files_Sharing\\External\\Cache' => $baseDir . '/../lib/External/Cache.php', |
|
| 36 | - 'OCA\\Files_Sharing\\External\\Manager' => $baseDir . '/../lib/External/Manager.php', |
|
| 37 | - 'OCA\\Files_Sharing\\External\\Mount' => $baseDir . '/../lib/External/Mount.php', |
|
| 38 | - 'OCA\\Files_Sharing\\External\\MountProvider' => $baseDir . '/../lib/External/MountProvider.php', |
|
| 39 | - 'OCA\\Files_Sharing\\External\\Scanner' => $baseDir . '/../lib/External/Scanner.php', |
|
| 40 | - 'OCA\\Files_Sharing\\External\\Storage' => $baseDir . '/../lib/External/Storage.php', |
|
| 41 | - 'OCA\\Files_Sharing\\External\\Watcher' => $baseDir . '/../lib/External/Watcher.php', |
|
| 42 | - 'OCA\\Files_Sharing\\Helper' => $baseDir . '/../lib/Helper.php', |
|
| 43 | - 'OCA\\Files_Sharing\\Hooks' => $baseDir . '/../lib/Hooks.php', |
|
| 44 | - 'OCA\\Files_Sharing\\ISharedStorage' => $baseDir . '/../lib/ISharedStorage.php', |
|
| 45 | - 'OCA\\Files_Sharing\\Middleware\\OCSShareAPIMiddleware' => $baseDir . '/../lib/Middleware/OCSShareAPIMiddleware.php', |
|
| 46 | - 'OCA\\Files_Sharing\\Middleware\\ShareInfoMiddleware' => $baseDir . '/../lib/Middleware/ShareInfoMiddleware.php', |
|
| 47 | - 'OCA\\Files_Sharing\\Middleware\\SharingCheckMiddleware' => $baseDir . '/../lib/Middleware/SharingCheckMiddleware.php', |
|
| 48 | - 'OCA\\Files_Sharing\\Migration\\OwncloudGuestShareType' => $baseDir . '/../lib/Migration/OwncloudGuestShareType.php', |
|
| 49 | - 'OCA\\Files_Sharing\\Migration\\SetPasswordColumn' => $baseDir . '/../lib/Migration/SetPasswordColumn.php', |
|
| 50 | - 'OCA\\Files_Sharing\\MountProvider' => $baseDir . '/../lib/MountProvider.php', |
|
| 51 | - 'OCA\\Files_Sharing\\Scanner' => $baseDir . '/../lib/Scanner.php', |
|
| 52 | - 'OCA\\Files_Sharing\\ShareBackend\\File' => $baseDir . '/../lib/ShareBackend/File.php', |
|
| 53 | - 'OCA\\Files_Sharing\\ShareBackend\\Folder' => $baseDir . '/../lib/ShareBackend/Folder.php', |
|
| 54 | - 'OCA\\Files_Sharing\\SharedMount' => $baseDir . '/../lib/SharedMount.php', |
|
| 55 | - 'OCA\\Files_Sharing\\SharedStorage' => $baseDir . '/../lib/SharedStorage.php', |
|
| 56 | - 'OCA\\Files_Sharing\\Updater' => $baseDir . '/../lib/Updater.php', |
|
| 9 | + 'OCA\\Files_Sharing\\Activity\\Filter' => $baseDir.'/../lib/Activity/Filter.php', |
|
| 10 | + 'OCA\\Files_Sharing\\Activity\\Providers\\Base' => $baseDir.'/../lib/Activity/Providers/Base.php', |
|
| 11 | + 'OCA\\Files_Sharing\\Activity\\Providers\\Downloads' => $baseDir.'/../lib/Activity/Providers/Downloads.php', |
|
| 12 | + 'OCA\\Files_Sharing\\Activity\\Providers\\Groups' => $baseDir.'/../lib/Activity/Providers/Groups.php', |
|
| 13 | + 'OCA\\Files_Sharing\\Activity\\Providers\\PublicLinks' => $baseDir.'/../lib/Activity/Providers/PublicLinks.php', |
|
| 14 | + 'OCA\\Files_Sharing\\Activity\\Providers\\RemoteShares' => $baseDir.'/../lib/Activity/Providers/RemoteShares.php', |
|
| 15 | + 'OCA\\Files_Sharing\\Activity\\Providers\\Users' => $baseDir.'/../lib/Activity/Providers/Users.php', |
|
| 16 | + 'OCA\\Files_Sharing\\Activity\\Settings\\PublicLinks' => $baseDir.'/../lib/Activity/Settings/PublicLinks.php', |
|
| 17 | + 'OCA\\Files_Sharing\\Activity\\Settings\\RemoteShare' => $baseDir.'/../lib/Activity/Settings/RemoteShare.php', |
|
| 18 | + 'OCA\\Files_Sharing\\Activity\\Settings\\Shared' => $baseDir.'/../lib/Activity/Settings/Shared.php', |
|
| 19 | + 'OCA\\Files_Sharing\\AppInfo\\Application' => $baseDir.'/../lib/AppInfo/Application.php', |
|
| 20 | + 'OCA\\Files_Sharing\\Cache' => $baseDir.'/../lib/Cache.php', |
|
| 21 | + 'OCA\\Files_Sharing\\Capabilities' => $baseDir.'/../lib/Capabilities.php', |
|
| 22 | + 'OCA\\Files_Sharing\\Collaboration\\ShareRecipientSorter' => $baseDir.'/../lib/Collaboration/ShareRecipientSorter.php', |
|
| 23 | + 'OCA\\Files_Sharing\\Command\\CleanupRemoteStorages' => $baseDir.'/../lib/Command/CleanupRemoteStorages.php', |
|
| 24 | + 'OCA\\Files_Sharing\\Controller\\ExternalSharesController' => $baseDir.'/../lib/Controller/ExternalSharesController.php', |
|
| 25 | + 'OCA\\Files_Sharing\\Controller\\PublicPreviewController' => $baseDir.'/../lib/Controller/PublicPreviewController.php', |
|
| 26 | + 'OCA\\Files_Sharing\\Controller\\RemoteController' => $baseDir.'/../lib/Controller/RemoteController.php', |
|
| 27 | + 'OCA\\Files_Sharing\\Controller\\ShareAPIController' => $baseDir.'/../lib/Controller/ShareAPIController.php', |
|
| 28 | + 'OCA\\Files_Sharing\\Controller\\ShareController' => $baseDir.'/../lib/Controller/ShareController.php', |
|
| 29 | + 'OCA\\Files_Sharing\\Controller\\ShareInfoController' => $baseDir.'/../lib/Controller/ShareInfoController.php', |
|
| 30 | + 'OCA\\Files_Sharing\\Controller\\ShareesAPIController' => $baseDir.'/../lib/Controller/ShareesAPIController.php', |
|
| 31 | + 'OCA\\Files_Sharing\\DeleteOrphanedSharesJob' => $baseDir.'/../lib/DeleteOrphanedSharesJob.php', |
|
| 32 | + 'OCA\\Files_Sharing\\Exceptions\\BrokenPath' => $baseDir.'/../lib/Exceptions/BrokenPath.php', |
|
| 33 | + 'OCA\\Files_Sharing\\Exceptions\\S2SException' => $baseDir.'/../lib/Exceptions/S2SException.php', |
|
| 34 | + 'OCA\\Files_Sharing\\ExpireSharesJob' => $baseDir.'/../lib/ExpireSharesJob.php', |
|
| 35 | + 'OCA\\Files_Sharing\\External\\Cache' => $baseDir.'/../lib/External/Cache.php', |
|
| 36 | + 'OCA\\Files_Sharing\\External\\Manager' => $baseDir.'/../lib/External/Manager.php', |
|
| 37 | + 'OCA\\Files_Sharing\\External\\Mount' => $baseDir.'/../lib/External/Mount.php', |
|
| 38 | + 'OCA\\Files_Sharing\\External\\MountProvider' => $baseDir.'/../lib/External/MountProvider.php', |
|
| 39 | + 'OCA\\Files_Sharing\\External\\Scanner' => $baseDir.'/../lib/External/Scanner.php', |
|
| 40 | + 'OCA\\Files_Sharing\\External\\Storage' => $baseDir.'/../lib/External/Storage.php', |
|
| 41 | + 'OCA\\Files_Sharing\\External\\Watcher' => $baseDir.'/../lib/External/Watcher.php', |
|
| 42 | + 'OCA\\Files_Sharing\\Helper' => $baseDir.'/../lib/Helper.php', |
|
| 43 | + 'OCA\\Files_Sharing\\Hooks' => $baseDir.'/../lib/Hooks.php', |
|
| 44 | + 'OCA\\Files_Sharing\\ISharedStorage' => $baseDir.'/../lib/ISharedStorage.php', |
|
| 45 | + 'OCA\\Files_Sharing\\Middleware\\OCSShareAPIMiddleware' => $baseDir.'/../lib/Middleware/OCSShareAPIMiddleware.php', |
|
| 46 | + 'OCA\\Files_Sharing\\Middleware\\ShareInfoMiddleware' => $baseDir.'/../lib/Middleware/ShareInfoMiddleware.php', |
|
| 47 | + 'OCA\\Files_Sharing\\Middleware\\SharingCheckMiddleware' => $baseDir.'/../lib/Middleware/SharingCheckMiddleware.php', |
|
| 48 | + 'OCA\\Files_Sharing\\Migration\\OwncloudGuestShareType' => $baseDir.'/../lib/Migration/OwncloudGuestShareType.php', |
|
| 49 | + 'OCA\\Files_Sharing\\Migration\\SetPasswordColumn' => $baseDir.'/../lib/Migration/SetPasswordColumn.php', |
|
| 50 | + 'OCA\\Files_Sharing\\MountProvider' => $baseDir.'/../lib/MountProvider.php', |
|
| 51 | + 'OCA\\Files_Sharing\\Scanner' => $baseDir.'/../lib/Scanner.php', |
|
| 52 | + 'OCA\\Files_Sharing\\ShareBackend\\File' => $baseDir.'/../lib/ShareBackend/File.php', |
|
| 53 | + 'OCA\\Files_Sharing\\ShareBackend\\Folder' => $baseDir.'/../lib/ShareBackend/Folder.php', |
|
| 54 | + 'OCA\\Files_Sharing\\SharedMount' => $baseDir.'/../lib/SharedMount.php', |
|
| 55 | + 'OCA\\Files_Sharing\\SharedStorage' => $baseDir.'/../lib/SharedStorage.php', |
|
| 56 | + 'OCA\\Files_Sharing\\Updater' => $baseDir.'/../lib/Updater.php', |
|
| 57 | 57 | ); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $this->configuration = new Configuration($configPrefix, |
| 94 | 94 | !is_null($configID)); |
| 95 | 95 | $memcache = \OC::$server->getMemCacheFactory(); |
| 96 | - if($memcache->isAvailable()) { |
|
| 96 | + if ($memcache->isAvailable()) { |
|
| 97 | 97 | $this->cache = $memcache->create(); |
| 98 | 98 | } |
| 99 | 99 | $helper = new Helper(\OC::$server->getConfig()); |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | public function __destruct() { |
| 108 | - if(!$this->dontDestruct && $this->ldap->isResource($this->ldapConnectionRes)) { |
|
| 108 | + if (!$this->dontDestruct && $this->ldap->isResource($this->ldapConnectionRes)) { |
|
| 109 | 109 | @$this->ldap->unbind($this->ldapConnectionRes); |
| 110 | 110 | }; |
| 111 | 111 | } |
@@ -125,11 +125,11 @@ discard block |
||
| 125 | 125 | * @return bool|mixed |
| 126 | 126 | */ |
| 127 | 127 | public function __get($name) { |
| 128 | - if(!$this->configured) { |
|
| 128 | + if (!$this->configured) { |
|
| 129 | 129 | $this->readConfiguration(); |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - if($name === 'hasPagedResultSupport') { |
|
| 132 | + if ($name === 'hasPagedResultSupport') { |
|
| 133 | 133 | return $this->hasPagedResultSupport; |
| 134 | 134 | } |
| 135 | 135 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | $before = $this->configuration->$name; |
| 146 | 146 | $this->configuration->$name = $value; |
| 147 | 147 | $after = $this->configuration->$name; |
| 148 | - if($before !== $after) { |
|
| 148 | + if ($before !== $after) { |
|
| 149 | 149 | if ($this->configID !== '') { |
| 150 | 150 | $this->configuration->saveConfiguration(); |
| 151 | 151 | } |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * @param bool $state |
| 161 | 161 | */ |
| 162 | 162 | public function setIgnoreValidation($state) { |
| 163 | - $this->ignoreValidation = (bool)$state; |
|
| 163 | + $this->ignoreValidation = (bool) $state; |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | /** |
@@ -176,14 +176,14 @@ discard block |
||
| 176 | 176 | * Returns the LDAP handler |
| 177 | 177 | */ |
| 178 | 178 | public function getConnectionResource() { |
| 179 | - if(!$this->ldapConnectionRes) { |
|
| 179 | + if (!$this->ldapConnectionRes) { |
|
| 180 | 180 | $this->init(); |
| 181 | - } else if(!$this->ldap->isResource($this->ldapConnectionRes)) { |
|
| 181 | + } else if (!$this->ldap->isResource($this->ldapConnectionRes)) { |
|
| 182 | 182 | $this->ldapConnectionRes = null; |
| 183 | 183 | $this->establishConnection(); |
| 184 | 184 | } |
| 185 | - if(is_null($this->ldapConnectionRes)) { |
|
| 186 | - \OCP\Util::writeLog('user_ldap', 'No LDAP Connection to server ' . $this->configuration->ldapHost, \OCP\Util::ERROR); |
|
| 185 | + if (is_null($this->ldapConnectionRes)) { |
|
| 186 | + \OCP\Util::writeLog('user_ldap', 'No LDAP Connection to server '.$this->configuration->ldapHost, \OCP\Util::ERROR); |
|
| 187 | 187 | throw new ServerNotAvailableException('Connection to LDAP server could not be established'); |
| 188 | 188 | } |
| 189 | 189 | return $this->ldapConnectionRes; |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | * resets the connection resource |
| 194 | 194 | */ |
| 195 | 195 | public function resetConnectionResource() { |
| 196 | - if(!is_null($this->ldapConnectionRes)) { |
|
| 196 | + if (!is_null($this->ldapConnectionRes)) { |
|
| 197 | 197 | @$this->ldap->unbind($this->ldapConnectionRes); |
| 198 | 198 | $this->ldapConnectionRes = null; |
| 199 | 199 | } |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | */ |
| 206 | 206 | private function getCacheKey($key) { |
| 207 | 207 | $prefix = 'LDAP-'.$this->configID.'-'.$this->configPrefix.'-'; |
| 208 | - if(is_null($key)) { |
|
| 208 | + if (is_null($key)) { |
|
| 209 | 209 | return $prefix; |
| 210 | 210 | } |
| 211 | 211 | return $prefix.md5($key); |
@@ -216,10 +216,10 @@ discard block |
||
| 216 | 216 | * @return mixed|null |
| 217 | 217 | */ |
| 218 | 218 | public function getFromCache($key) { |
| 219 | - if(!$this->configured) { |
|
| 219 | + if (!$this->configured) { |
|
| 220 | 220 | $this->readConfiguration(); |
| 221 | 221 | } |
| 222 | - if(is_null($this->cache) || !$this->configuration->ldapCacheTTL) { |
|
| 222 | + if (is_null($this->cache) || !$this->configuration->ldapCacheTTL) { |
|
| 223 | 223 | return null; |
| 224 | 224 | } |
| 225 | 225 | $key = $this->getCacheKey($key); |
@@ -234,10 +234,10 @@ discard block |
||
| 234 | 234 | * @return string |
| 235 | 235 | */ |
| 236 | 236 | public function writeToCache($key, $value) { |
| 237 | - if(!$this->configured) { |
|
| 237 | + if (!$this->configured) { |
|
| 238 | 238 | $this->readConfiguration(); |
| 239 | 239 | } |
| 240 | - if(is_null($this->cache) |
|
| 240 | + if (is_null($this->cache) |
|
| 241 | 241 | || !$this->configuration->ldapCacheTTL |
| 242 | 242 | || !$this->configuration->ldapConfigurationActive) { |
| 243 | 243 | return null; |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | public function clearCache() { |
| 251 | - if(!is_null($this->cache)) { |
|
| 251 | + if (!is_null($this->cache)) { |
|
| 252 | 252 | $this->cache->clear($this->getCacheKey(null)); |
| 253 | 253 | } |
| 254 | 254 | } |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | * @return null |
| 261 | 261 | */ |
| 262 | 262 | private function readConfiguration($force = false) { |
| 263 | - if((!$this->configured || $force) && !is_null($this->configID)) { |
|
| 263 | + if ((!$this->configured || $force) && !is_null($this->configID)) { |
|
| 264 | 264 | $this->configuration->readConfiguration(); |
| 265 | 265 | $this->configured = $this->validateConfiguration(); |
| 266 | 266 | } |
@@ -273,12 +273,12 @@ discard block |
||
| 273 | 273 | * @return boolean true if config validates, false otherwise. Check with $setParameters for detailed success on single parameters |
| 274 | 274 | */ |
| 275 | 275 | public function setConfiguration($config, &$setParameters = null) { |
| 276 | - if(is_null($setParameters)) { |
|
| 276 | + if (is_null($setParameters)) { |
|
| 277 | 277 | $setParameters = array(); |
| 278 | 278 | } |
| 279 | 279 | $this->doNotValidate = false; |
| 280 | 280 | $this->configuration->setConfiguration($config, $setParameters); |
| 281 | - if(count($setParameters) > 0) { |
|
| 281 | + if (count($setParameters) > 0) { |
|
| 282 | 282 | $this->configured = $this->validateConfiguration(); |
| 283 | 283 | } |
| 284 | 284 | |
@@ -305,10 +305,10 @@ discard block |
||
| 305 | 305 | $config = $this->configuration->getConfiguration(); |
| 306 | 306 | $cta = $this->configuration->getConfigTranslationArray(); |
| 307 | 307 | $result = array(); |
| 308 | - foreach($cta as $dbkey => $configkey) { |
|
| 309 | - switch($configkey) { |
|
| 308 | + foreach ($cta as $dbkey => $configkey) { |
|
| 309 | + switch ($configkey) { |
|
| 310 | 310 | case 'homeFolderNamingRule': |
| 311 | - if(strpos($config[$configkey], 'attr:') === 0) { |
|
| 311 | + if (strpos($config[$configkey], 'attr:') === 0) { |
|
| 312 | 312 | $result[$dbkey] = substr($config[$configkey], 5); |
| 313 | 313 | } else { |
| 314 | 314 | $result[$dbkey] = ''; |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | case 'ldapBaseGroups': |
| 320 | 320 | case 'ldapAttributesForUserSearch': |
| 321 | 321 | case 'ldapAttributesForGroupSearch': |
| 322 | - if(is_array($config[$configkey])) { |
|
| 322 | + if (is_array($config[$configkey])) { |
|
| 323 | 323 | $result[$dbkey] = implode("\n", $config[$configkey]); |
| 324 | 324 | break; |
| 325 | 325 | } //else follows default |
@@ -332,23 +332,23 @@ discard block |
||
| 332 | 332 | |
| 333 | 333 | private function doSoftValidation() { |
| 334 | 334 | //if User or Group Base are not set, take over Base DN setting |
| 335 | - foreach(array('ldapBaseUsers', 'ldapBaseGroups') as $keyBase) { |
|
| 335 | + foreach (array('ldapBaseUsers', 'ldapBaseGroups') as $keyBase) { |
|
| 336 | 336 | $val = $this->configuration->$keyBase; |
| 337 | - if(empty($val)) { |
|
| 337 | + if (empty($val)) { |
|
| 338 | 338 | $this->configuration->$keyBase = $this->configuration->ldapBase; |
| 339 | 339 | } |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | - foreach(array('ldapExpertUUIDUserAttr' => 'ldapUuidUserAttribute', |
|
| 342 | + foreach (array('ldapExpertUUIDUserAttr' => 'ldapUuidUserAttribute', |
|
| 343 | 343 | 'ldapExpertUUIDGroupAttr' => 'ldapUuidGroupAttribute') |
| 344 | 344 | as $expertSetting => $effectiveSetting) { |
| 345 | 345 | $uuidOverride = $this->configuration->$expertSetting; |
| 346 | - if(!empty($uuidOverride)) { |
|
| 346 | + if (!empty($uuidOverride)) { |
|
| 347 | 347 | $this->configuration->$effectiveSetting = $uuidOverride; |
| 348 | 348 | } else { |
| 349 | 349 | $uuidAttributes = array('auto', 'entryuuid', 'nsuniqueid', |
| 350 | 350 | 'objectguid', 'guid', 'ipauniqueid'); |
| 351 | - if(!in_array($this->configuration->$effectiveSetting, |
|
| 351 | + if (!in_array($this->configuration->$effectiveSetting, |
|
| 352 | 352 | $uuidAttributes) |
| 353 | 353 | && (!is_null($this->configID))) { |
| 354 | 354 | $this->configuration->$effectiveSetting = 'auto'; |
@@ -370,14 +370,14 @@ discard block |
||
| 370 | 370 | //make sure empty search attributes are saved as simple, empty array |
| 371 | 371 | $saKeys = array('ldapAttributesForUserSearch', |
| 372 | 372 | 'ldapAttributesForGroupSearch'); |
| 373 | - foreach($saKeys as $key) { |
|
| 373 | + foreach ($saKeys as $key) { |
|
| 374 | 374 | $val = $this->configuration->$key; |
| 375 | - if(is_array($val) && count($val) === 1 && empty($val[0])) { |
|
| 375 | + if (is_array($val) && count($val) === 1 && empty($val[0])) { |
|
| 376 | 376 | $this->configuration->$key = array(); |
| 377 | 377 | } |
| 378 | 378 | } |
| 379 | 379 | |
| 380 | - if((stripos($this->configuration->ldapHost, 'ldaps://') === 0) |
|
| 380 | + if ((stripos($this->configuration->ldapHost, 'ldaps://') === 0) |
|
| 381 | 381 | && $this->configuration->ldapTLS) { |
| 382 | 382 | $this->configuration->ldapTLS = false; |
| 383 | 383 | \OCP\Util::writeLog('user_ldap', |
@@ -398,10 +398,10 @@ discard block |
||
| 398 | 398 | //options that shall not be empty |
| 399 | 399 | $options = array('ldapHost', 'ldapPort', 'ldapUserDisplayName', |
| 400 | 400 | 'ldapGroupDisplayName', 'ldapLoginFilter'); |
| 401 | - foreach($options as $key) { |
|
| 401 | + foreach ($options as $key) { |
|
| 402 | 402 | $val = $this->configuration->$key; |
| 403 | - if(empty($val)) { |
|
| 404 | - switch($key) { |
|
| 403 | + if (empty($val)) { |
|
| 404 | + switch ($key) { |
|
| 405 | 405 | case 'ldapHost': |
| 406 | 406 | $subj = 'LDAP Host'; |
| 407 | 407 | break; |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | $agent = $this->configuration->ldapAgentName; |
| 433 | 433 | $pwd = $this->configuration->ldapAgentPassword; |
| 434 | 434 | if ( |
| 435 | - ($agent === '' && $pwd !== '') |
|
| 435 | + ($agent === '' && $pwd !== '') |
|
| 436 | 436 | || ($agent !== '' && $pwd === '') |
| 437 | 437 | ) { |
| 438 | 438 | \OCP\Util::writeLog('user_ldap', |
@@ -447,14 +447,14 @@ discard block |
||
| 447 | 447 | $baseUsers = $this->configuration->ldapBaseUsers; |
| 448 | 448 | $baseGroups = $this->configuration->ldapBaseGroups; |
| 449 | 449 | |
| 450 | - if(empty($base) && empty($baseUsers) && empty($baseGroups)) { |
|
| 450 | + if (empty($base) && empty($baseUsers) && empty($baseGroups)) { |
|
| 451 | 451 | \OCP\Util::writeLog('user_ldap', |
| 452 | 452 | $errorStr.'Not a single Base DN given.', |
| 453 | 453 | \OCP\Util::WARN); |
| 454 | 454 | $configurationOK = false; |
| 455 | 455 | } |
| 456 | 456 | |
| 457 | - if(mb_strpos($this->configuration->ldapLoginFilter, '%uid', 0, 'UTF-8') |
|
| 457 | + if (mb_strpos($this->configuration->ldapLoginFilter, '%uid', 0, 'UTF-8') |
|
| 458 | 458 | === false) { |
| 459 | 459 | \OCP\Util::writeLog('user_ldap', |
| 460 | 460 | $errorStr.'login filter does not contain %uid '. |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | */ |
| 473 | 473 | private function validateConfiguration() { |
| 474 | 474 | |
| 475 | - if($this->doNotValidate) { |
|
| 475 | + if ($this->doNotValidate) { |
|
| 476 | 476 | //don't do a validation if it is a new configuration with pure |
| 477 | 477 | //default values. Will be allowed on changes via __set or |
| 478 | 478 | //setConfiguration |
@@ -493,21 +493,21 @@ discard block |
||
| 493 | 493 | * Connects and Binds to LDAP |
| 494 | 494 | */ |
| 495 | 495 | private function establishConnection() { |
| 496 | - if(!$this->configuration->ldapConfigurationActive) { |
|
| 496 | + if (!$this->configuration->ldapConfigurationActive) { |
|
| 497 | 497 | return null; |
| 498 | 498 | } |
| 499 | 499 | static $phpLDAPinstalled = true; |
| 500 | - if(!$phpLDAPinstalled) { |
|
| 500 | + if (!$phpLDAPinstalled) { |
|
| 501 | 501 | return false; |
| 502 | 502 | } |
| 503 | - if(!$this->ignoreValidation && !$this->configured) { |
|
| 503 | + if (!$this->ignoreValidation && !$this->configured) { |
|
| 504 | 504 | \OCP\Util::writeLog('user_ldap', |
| 505 | 505 | 'Configuration is invalid, cannot connect', |
| 506 | 506 | \OCP\Util::WARN); |
| 507 | 507 | return false; |
| 508 | 508 | } |
| 509 | - if(!$this->ldapConnectionRes) { |
|
| 510 | - if(!$this->ldap->areLDAPFunctionsAvailable()) { |
|
| 509 | + if (!$this->ldapConnectionRes) { |
|
| 510 | + if (!$this->ldap->areLDAPFunctionsAvailable()) { |
|
| 511 | 511 | $phpLDAPinstalled = false; |
| 512 | 512 | \OCP\Util::writeLog('user_ldap', |
| 513 | 513 | 'function ldap_connect is not available. Make '. |
@@ -516,8 +516,8 @@ discard block |
||
| 516 | 516 | |
| 517 | 517 | return false; |
| 518 | 518 | } |
| 519 | - if($this->configuration->turnOffCertCheck) { |
|
| 520 | - if(putenv('LDAPTLS_REQCERT=never')) { |
|
| 519 | + if ($this->configuration->turnOffCertCheck) { |
|
| 520 | + if (putenv('LDAPTLS_REQCERT=never')) { |
|
| 521 | 521 | \OCP\Util::writeLog('user_ldap', |
| 522 | 522 | 'Turned off SSL certificate validation successfully.', |
| 523 | 523 | \OCP\Util::DEBUG); |
@@ -541,23 +541,23 @@ discard block |
||
| 541 | 541 | $error = $this->ldap->isResource($this->ldapConnectionRes) ? |
| 542 | 542 | $this->ldap->errno($this->ldapConnectionRes) : -1; |
| 543 | 543 | } |
| 544 | - if($bindStatus === true) { |
|
| 544 | + if ($bindStatus === true) { |
|
| 545 | 545 | return $bindStatus; |
| 546 | 546 | } |
| 547 | 547 | } catch (ServerNotAvailableException $e) { |
| 548 | - if(!$isBackupHost) { |
|
| 548 | + if (!$isBackupHost) { |
|
| 549 | 549 | throw $e; |
| 550 | 550 | } |
| 551 | 551 | } |
| 552 | 552 | |
| 553 | 553 | //if LDAP server is not reachable, try the Backup (Replica!) Server |
| 554 | - if($isBackupHost && ($error !== 0 || $isOverrideMainServer)) { |
|
| 554 | + if ($isBackupHost && ($error !== 0 || $isOverrideMainServer)) { |
|
| 555 | 555 | $this->doConnect($this->configuration->ldapBackupHost, |
| 556 | 556 | $this->configuration->ldapBackupPort); |
| 557 | 557 | $bindStatus = $this->bind(); |
| 558 | 558 | $error = $this->ldap->isResource($this->ldapConnectionRes) ? |
| 559 | 559 | $this->ldap->errno($this->ldapConnectionRes) : -1; |
| 560 | - if($bindStatus && $error === 0 && !$this->getFromCache('overrideMainServer')) { |
|
| 560 | + if ($bindStatus && $error === 0 && !$this->getFromCache('overrideMainServer')) { |
|
| 561 | 561 | //when bind to backup server succeeded and failed to main server, |
| 562 | 562 | //skip contacting him until next cache refresh |
| 563 | 563 | $this->writeToCache('overrideMainServer', true); |
@@ -582,17 +582,17 @@ discard block |
||
| 582 | 582 | |
| 583 | 583 | $this->ldapConnectionRes = $this->ldap->connect($host, $port); |
| 584 | 584 | |
| 585 | - if(!$this->ldap->setOption($this->ldapConnectionRes, LDAP_OPT_PROTOCOL_VERSION, 3)) { |
|
| 585 | + if (!$this->ldap->setOption($this->ldapConnectionRes, LDAP_OPT_PROTOCOL_VERSION, 3)) { |
|
| 586 | 586 | throw new ServerNotAvailableException('Could not set required LDAP Protocol version.'); |
| 587 | 587 | } |
| 588 | 588 | |
| 589 | - if(!$this->ldap->setOption($this->ldapConnectionRes, LDAP_OPT_REFERRALS, 0)) { |
|
| 589 | + if (!$this->ldap->setOption($this->ldapConnectionRes, LDAP_OPT_REFERRALS, 0)) { |
|
| 590 | 590 | throw new ServerNotAvailableException('Could not disable LDAP referrals.'); |
| 591 | 591 | } |
| 592 | 592 | |
| 593 | - if($this->configuration->ldapTLS) { |
|
| 594 | - if(!$this->ldap->startTls($this->ldapConnectionRes)) { |
|
| 595 | - throw new ServerNotAvailableException('Start TLS failed, when connecting to LDAP host ' . $host . '.'); |
|
| 593 | + if ($this->configuration->ldapTLS) { |
|
| 594 | + if (!$this->ldap->startTls($this->ldapConnectionRes)) { |
|
| 595 | + throw new ServerNotAvailableException('Start TLS failed, when connecting to LDAP host '.$host.'.'); |
|
| 596 | 596 | } |
| 597 | 597 | } |
| 598 | 598 | |
@@ -603,25 +603,25 @@ discard block |
||
| 603 | 603 | * Binds to LDAP |
| 604 | 604 | */ |
| 605 | 605 | public function bind() { |
| 606 | - if(!$this->configuration->ldapConfigurationActive) { |
|
| 606 | + if (!$this->configuration->ldapConfigurationActive) { |
|
| 607 | 607 | return false; |
| 608 | 608 | } |
| 609 | 609 | $cr = $this->getConnectionResource(); |
| 610 | - if(!$this->ldap->isResource($cr)) { |
|
| 610 | + if (!$this->ldap->isResource($cr)) { |
|
| 611 | 611 | return false; |
| 612 | 612 | } |
| 613 | 613 | $ldapLogin = @$this->ldap->bind($cr, |
| 614 | 614 | $this->configuration->ldapAgentName, |
| 615 | 615 | $this->configuration->ldapAgentPassword); |
| 616 | - if(!$ldapLogin) { |
|
| 616 | + if (!$ldapLogin) { |
|
| 617 | 617 | $errno = $this->ldap->errno($cr); |
| 618 | 618 | |
| 619 | 619 | \OCP\Util::writeLog('user_ldap', |
| 620 | - 'Bind failed: ' . $errno . ': ' . $this->ldap->error($cr), |
|
| 620 | + 'Bind failed: '.$errno.': '.$this->ldap->error($cr), |
|
| 621 | 621 | \OCP\Util::WARN); |
| 622 | 622 | |
| 623 | 623 | // Set to failure mode, if LDAP error code is not LDAP_SUCCESS or LDAP_INVALID_CREDENTIALS |
| 624 | - if($errno !== 0x00 && $errno !== 0x31) { |
|
| 624 | + if ($errno !== 0x00 && $errno !== 0x31) { |
|
| 625 | 625 | $this->ldapConnectionRes = null; |
| 626 | 626 | } |
| 627 | 627 | |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | * @return AbstractMapping |
| 113 | 113 | */ |
| 114 | 114 | public function getUserMapper() { |
| 115 | - if(is_null($this->userMapper)) { |
|
| 115 | + if (is_null($this->userMapper)) { |
|
| 116 | 116 | throw new \Exception('UserMapper was not assigned to this Access instance.'); |
| 117 | 117 | } |
| 118 | 118 | return $this->userMapper; |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | * @return AbstractMapping |
| 133 | 133 | */ |
| 134 | 134 | public function getGroupMapper() { |
| 135 | - if(is_null($this->groupMapper)) { |
|
| 135 | + if (is_null($this->groupMapper)) { |
|
| 136 | 136 | throw new \Exception('GroupMapper was not assigned to this Access instance.'); |
| 137 | 137 | } |
| 138 | 138 | return $this->groupMapper; |
@@ -163,14 +163,14 @@ discard block |
||
| 163 | 163 | * array if $attr is empty, false otherwise |
| 164 | 164 | */ |
| 165 | 165 | public function readAttribute($dn, $attr, $filter = 'objectClass=*') { |
| 166 | - if(!$this->checkConnection()) { |
|
| 166 | + if (!$this->checkConnection()) { |
|
| 167 | 167 | \OCP\Util::writeLog('user_ldap', |
| 168 | 168 | 'No LDAP Connector assigned, access impossible for readAttribute.', |
| 169 | 169 | \OCP\Util::WARN); |
| 170 | 170 | return false; |
| 171 | 171 | } |
| 172 | 172 | $cr = $this->connection->getConnectionResource(); |
| 173 | - if(!$this->ldap->isResource($cr)) { |
|
| 173 | + if (!$this->ldap->isResource($cr)) { |
|
| 174 | 174 | //LDAP not available |
| 175 | 175 | \OCP\Util::writeLog('user_ldap', 'LDAP resource not available.', \OCP\Util::DEBUG); |
| 176 | 176 | return false; |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | $isRangeRequest = false; |
| 194 | 194 | do { |
| 195 | 195 | $result = $this->executeRead($cr, $dn, $attrToRead, $filter, $maxResults); |
| 196 | - if(is_bool($result)) { |
|
| 196 | + if (is_bool($result)) { |
|
| 197 | 197 | // when an exists request was run and it was successful, an empty |
| 198 | 198 | // array must be returned |
| 199 | 199 | return $result ? [] : false; |
@@ -210,22 +210,22 @@ discard block |
||
| 210 | 210 | $result = $this->extractRangeData($result, $attr); |
| 211 | 211 | if (!empty($result)) { |
| 212 | 212 | $normalizedResult = $this->extractAttributeValuesFromResult( |
| 213 | - [ $attr => $result['values'] ], |
|
| 213 | + [$attr => $result['values']], |
|
| 214 | 214 | $attr |
| 215 | 215 | ); |
| 216 | 216 | $values = array_merge($values, $normalizedResult); |
| 217 | 217 | |
| 218 | - if($result['rangeHigh'] === '*') { |
|
| 218 | + if ($result['rangeHigh'] === '*') { |
|
| 219 | 219 | // when server replies with * as high range value, there are |
| 220 | 220 | // no more results left |
| 221 | 221 | return $values; |
| 222 | 222 | } else { |
| 223 | - $low = $result['rangeHigh'] + 1; |
|
| 224 | - $attrToRead = $result['attributeName'] . ';range=' . $low . '-*'; |
|
| 223 | + $low = $result['rangeHigh'] + 1; |
|
| 224 | + $attrToRead = $result['attributeName'].';range='.$low.'-*'; |
|
| 225 | 225 | $isRangeRequest = true; |
| 226 | 226 | } |
| 227 | 227 | } |
| 228 | - } while($isRangeRequest); |
|
| 228 | + } while ($isRangeRequest); |
|
| 229 | 229 | |
| 230 | 230 | \OCP\Util::writeLog('user_ldap', 'Requested attribute '.$attr.' not found for '.$dn, \OCP\Util::DEBUG); |
| 231 | 231 | return false; |
@@ -250,13 +250,13 @@ discard block |
||
| 250 | 250 | if (!$this->ldap->isResource($rr)) { |
| 251 | 251 | if ($attribute !== '') { |
| 252 | 252 | //do not throw this message on userExists check, irritates |
| 253 | - \OCP\Util::writeLog('user_ldap', 'readAttribute failed for DN ' . $dn, \OCP\Util::DEBUG); |
|
| 253 | + \OCP\Util::writeLog('user_ldap', 'readAttribute failed for DN '.$dn, \OCP\Util::DEBUG); |
|
| 254 | 254 | } |
| 255 | 255 | //in case an error occurs , e.g. object does not exist |
| 256 | 256 | return false; |
| 257 | 257 | } |
| 258 | 258 | if ($attribute === '' && ($filter === 'objectclass=*' || $this->invokeLDAPMethod('countEntries', $cr, $rr) === 1)) { |
| 259 | - \OCP\Util::writeLog('user_ldap', 'readAttribute: ' . $dn . ' found', \OCP\Util::DEBUG); |
|
| 259 | + \OCP\Util::writeLog('user_ldap', 'readAttribute: '.$dn.' found', \OCP\Util::DEBUG); |
|
| 260 | 260 | return true; |
| 261 | 261 | } |
| 262 | 262 | $er = $this->invokeLDAPMethod('firstEntry', $cr, $rr); |
@@ -281,12 +281,12 @@ discard block |
||
| 281 | 281 | */ |
| 282 | 282 | public function extractAttributeValuesFromResult($result, $attribute) { |
| 283 | 283 | $values = []; |
| 284 | - if(isset($result[$attribute]) && $result[$attribute]['count'] > 0) { |
|
| 284 | + if (isset($result[$attribute]) && $result[$attribute]['count'] > 0) { |
|
| 285 | 285 | $lowercaseAttribute = strtolower($attribute); |
| 286 | - for($i=0;$i<$result[$attribute]['count'];$i++) { |
|
| 287 | - if($this->resemblesDN($attribute)) { |
|
| 286 | + for ($i = 0; $i < $result[$attribute]['count']; $i++) { |
|
| 287 | + if ($this->resemblesDN($attribute)) { |
|
| 288 | 288 | $values[] = $this->helper->sanitizeDN($result[$attribute][$i]); |
| 289 | - } elseif($lowercaseAttribute === 'objectguid' || $lowercaseAttribute === 'guid') { |
|
| 289 | + } elseif ($lowercaseAttribute === 'objectguid' || $lowercaseAttribute === 'guid') { |
|
| 290 | 290 | $values[] = $this->convertObjectGUID2Str($result[$attribute][$i]); |
| 291 | 291 | } else { |
| 292 | 292 | $values[] = $result[$attribute][$i]; |
@@ -308,10 +308,10 @@ discard block |
||
| 308 | 308 | */ |
| 309 | 309 | public function extractRangeData($result, $attribute) { |
| 310 | 310 | $keys = array_keys($result); |
| 311 | - foreach($keys as $key) { |
|
| 312 | - if($key !== $attribute && strpos($key, $attribute) === 0) { |
|
| 311 | + foreach ($keys as $key) { |
|
| 312 | + if ($key !== $attribute && strpos($key, $attribute) === 0) { |
|
| 313 | 313 | $queryData = explode(';', $key); |
| 314 | - if(strpos($queryData[1], 'range=') === 0) { |
|
| 314 | + if (strpos($queryData[1], 'range=') === 0) { |
|
| 315 | 315 | $high = substr($queryData[1], 1 + strpos($queryData[1], '-')); |
| 316 | 316 | $data = [ |
| 317 | 317 | 'values' => $result[$key], |
@@ -336,18 +336,18 @@ discard block |
||
| 336 | 336 | * @throws \Exception |
| 337 | 337 | */ |
| 338 | 338 | public function setPassword($userDN, $password) { |
| 339 | - if(intval($this->connection->turnOnPasswordChange) !== 1) { |
|
| 339 | + if (intval($this->connection->turnOnPasswordChange) !== 1) { |
|
| 340 | 340 | throw new \Exception('LDAP password changes are disabled.'); |
| 341 | 341 | } |
| 342 | 342 | $cr = $this->connection->getConnectionResource(); |
| 343 | - if(!$this->ldap->isResource($cr)) { |
|
| 343 | + if (!$this->ldap->isResource($cr)) { |
|
| 344 | 344 | //LDAP not available |
| 345 | 345 | \OCP\Util::writeLog('user_ldap', 'LDAP resource not available.', \OCP\Util::DEBUG); |
| 346 | 346 | return false; |
| 347 | 347 | } |
| 348 | 348 | try { |
| 349 | 349 | return @$this->invokeLDAPMethod('modReplace', $cr, $userDN, $password); |
| 350 | - } catch(ConstraintViolationException $e) { |
|
| 350 | + } catch (ConstraintViolationException $e) { |
|
| 351 | 351 | throw new HintException('Password change rejected.', \OC::$server->getL10N('user_ldap')->t('Password change rejected. Hint: ').$e->getMessage(), $e->getCode()); |
| 352 | 352 | } |
| 353 | 353 | } |
@@ -389,17 +389,17 @@ discard block |
||
| 389 | 389 | */ |
| 390 | 390 | public function getDomainDNFromDN($dn) { |
| 391 | 391 | $allParts = $this->ldap->explodeDN($dn, 0); |
| 392 | - if($allParts === false) { |
|
| 392 | + if ($allParts === false) { |
|
| 393 | 393 | //not a valid DN |
| 394 | 394 | return ''; |
| 395 | 395 | } |
| 396 | 396 | $domainParts = array(); |
| 397 | 397 | $dcFound = false; |
| 398 | - foreach($allParts as $part) { |
|
| 399 | - if(!$dcFound && strpos($part, 'dc=') === 0) { |
|
| 398 | + foreach ($allParts as $part) { |
|
| 399 | + if (!$dcFound && strpos($part, 'dc=') === 0) { |
|
| 400 | 400 | $dcFound = true; |
| 401 | 401 | } |
| 402 | - if($dcFound) { |
|
| 402 | + if ($dcFound) { |
|
| 403 | 403 | $domainParts[] = $part; |
| 404 | 404 | } |
| 405 | 405 | } |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | |
| 427 | 427 | //Check whether the DN belongs to the Base, to avoid issues on multi- |
| 428 | 428 | //server setups |
| 429 | - if(is_string($fdn) && $this->isDNPartOfBase($fdn, $this->connection->ldapBaseUsers)) { |
|
| 429 | + if (is_string($fdn) && $this->isDNPartOfBase($fdn, $this->connection->ldapBaseUsers)) { |
|
| 430 | 430 | return $fdn; |
| 431 | 431 | } |
| 432 | 432 | |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | //To avoid bypassing the base DN settings under certain circumstances |
| 444 | 444 | //with the group support, check whether the provided DN matches one of |
| 445 | 445 | //the given Bases |
| 446 | - if(!$this->isDNPartOfBase($fdn, $this->connection->ldapBaseGroups)) { |
|
| 446 | + if (!$this->isDNPartOfBase($fdn, $this->connection->ldapBaseGroups)) { |
|
| 447 | 447 | return false; |
| 448 | 448 | } |
| 449 | 449 | |
@@ -460,11 +460,11 @@ discard block |
||
| 460 | 460 | */ |
| 461 | 461 | public function groupsMatchFilter($groupDNs) { |
| 462 | 462 | $validGroupDNs = []; |
| 463 | - foreach($groupDNs as $dn) { |
|
| 463 | + foreach ($groupDNs as $dn) { |
|
| 464 | 464 | $cacheKey = 'groupsMatchFilter-'.$dn; |
| 465 | 465 | $groupMatchFilter = $this->connection->getFromCache($cacheKey); |
| 466 | - if(!is_null($groupMatchFilter)) { |
|
| 467 | - if($groupMatchFilter) { |
|
| 466 | + if (!is_null($groupMatchFilter)) { |
|
| 467 | + if ($groupMatchFilter) { |
|
| 468 | 468 | $validGroupDNs[] = $dn; |
| 469 | 469 | } |
| 470 | 470 | continue; |
@@ -472,13 +472,13 @@ discard block |
||
| 472 | 472 | |
| 473 | 473 | // Check the base DN first. If this is not met already, we don't |
| 474 | 474 | // need to ask the server at all. |
| 475 | - if(!$this->isDNPartOfBase($dn, $this->connection->ldapBaseGroups)) { |
|
| 475 | + if (!$this->isDNPartOfBase($dn, $this->connection->ldapBaseGroups)) { |
|
| 476 | 476 | $this->connection->writeToCache($cacheKey, false); |
| 477 | 477 | continue; |
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | $result = $this->readAttribute($dn, 'cn', $this->connection->ldapGroupFilter); |
| 481 | - if(is_array($result)) { |
|
| 481 | + if (is_array($result)) { |
|
| 482 | 482 | $this->connection->writeToCache($cacheKey, true); |
| 483 | 483 | $validGroupDNs[] = $dn; |
| 484 | 484 | } else { |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | //To avoid bypassing the base DN settings under certain circumstances |
| 500 | 500 | //with the group support, check whether the provided DN matches one of |
| 501 | 501 | //the given Bases |
| 502 | - if(!$this->isDNPartOfBase($fdn, $this->connection->ldapBaseUsers)) { |
|
| 502 | + if (!$this->isDNPartOfBase($fdn, $this->connection->ldapBaseUsers)) { |
|
| 503 | 503 | return false; |
| 504 | 504 | } |
| 505 | 505 | |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | * @return string|false with with the name to use in Nextcloud |
| 515 | 515 | */ |
| 516 | 516 | public function dn2ocname($fdn, $ldapName = null, $isUser = true) { |
| 517 | - if($isUser) { |
|
| 517 | + if ($isUser) { |
|
| 518 | 518 | $mapper = $this->getUserMapper(); |
| 519 | 519 | $nameAttribute = $this->connection->ldapUserDisplayName; |
| 520 | 520 | } else { |
@@ -524,15 +524,15 @@ discard block |
||
| 524 | 524 | |
| 525 | 525 | //let's try to retrieve the Nextcloud name from the mappings table |
| 526 | 526 | $ocName = $mapper->getNameByDN($fdn); |
| 527 | - if(is_string($ocName)) { |
|
| 527 | + if (is_string($ocName)) { |
|
| 528 | 528 | return $ocName; |
| 529 | 529 | } |
| 530 | 530 | |
| 531 | 531 | //second try: get the UUID and check if it is known. Then, update the DN and return the name. |
| 532 | 532 | $uuid = $this->getUUID($fdn, $isUser); |
| 533 | - if(is_string($uuid)) { |
|
| 533 | + if (is_string($uuid)) { |
|
| 534 | 534 | $ocName = $mapper->getNameByUUID($uuid); |
| 535 | - if(is_string($ocName)) { |
|
| 535 | + if (is_string($ocName)) { |
|
| 536 | 536 | $mapper->setDNbyUUID($fdn, $uuid); |
| 537 | 537 | return $ocName; |
| 538 | 538 | } |
@@ -542,16 +542,16 @@ discard block |
||
| 542 | 542 | return false; |
| 543 | 543 | } |
| 544 | 544 | |
| 545 | - if(is_null($ldapName)) { |
|
| 545 | + if (is_null($ldapName)) { |
|
| 546 | 546 | $ldapName = $this->readAttribute($fdn, $nameAttribute); |
| 547 | - if(!isset($ldapName[0]) && empty($ldapName[0])) { |
|
| 547 | + if (!isset($ldapName[0]) && empty($ldapName[0])) { |
|
| 548 | 548 | \OCP\Util::writeLog('user_ldap', 'No or empty name for '.$fdn.'.', \OCP\Util::INFO); |
| 549 | 549 | return false; |
| 550 | 550 | } |
| 551 | 551 | $ldapName = $ldapName[0]; |
| 552 | 552 | } |
| 553 | 553 | |
| 554 | - if($isUser) { |
|
| 554 | + if ($isUser) { |
|
| 555 | 555 | $usernameAttribute = strval($this->connection->ldapExpertUsernameAttr); |
| 556 | 556 | if ($usernameAttribute !== '') { |
| 557 | 557 | $username = $this->readAttribute($fdn, $usernameAttribute); |
@@ -570,9 +570,9 @@ discard block |
||
| 570 | 570 | // outside of core user management will still cache the user as non-existing. |
| 571 | 571 | $originalTTL = $this->connection->ldapCacheTTL; |
| 572 | 572 | $this->connection->setConfiguration(array('ldapCacheTTL' => 0)); |
| 573 | - if(($isUser && !\OCP\User::userExists($intName)) |
|
| 573 | + if (($isUser && !\OCP\User::userExists($intName)) |
|
| 574 | 574 | || (!$isUser && !\OC::$server->getGroupManager()->groupExists($intName))) { |
| 575 | - if($mapper->map($fdn, $intName, $uuid)) { |
|
| 575 | + if ($mapper->map($fdn, $intName, $uuid)) { |
|
| 576 | 576 | $this->connection->setConfiguration(array('ldapCacheTTL' => $originalTTL)); |
| 577 | 577 | return $intName; |
| 578 | 578 | } |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | $this->connection->setConfiguration(array('ldapCacheTTL' => $originalTTL)); |
| 581 | 581 | |
| 582 | 582 | $altName = $this->createAltInternalOwnCloudName($intName, $isUser); |
| 583 | - if(is_string($altName) && $mapper->map($fdn, $altName, $uuid)) { |
|
| 583 | + if (is_string($altName) && $mapper->map($fdn, $altName, $uuid)) { |
|
| 584 | 584 | return $altName; |
| 585 | 585 | } |
| 586 | 586 | |
@@ -617,7 +617,7 @@ discard block |
||
| 617 | 617 | * @return array |
| 618 | 618 | */ |
| 619 | 619 | private function ldap2NextcloudNames($ldapObjects, $isUsers) { |
| 620 | - if($isUsers) { |
|
| 620 | + if ($isUsers) { |
|
| 621 | 621 | $nameAttribute = $this->connection->ldapUserDisplayName; |
| 622 | 622 | $sndAttribute = $this->connection->ldapUserDisplayName2; |
| 623 | 623 | } else { |
@@ -625,9 +625,9 @@ discard block |
||
| 625 | 625 | } |
| 626 | 626 | $nextcloudNames = array(); |
| 627 | 627 | |
| 628 | - foreach($ldapObjects as $ldapObject) { |
|
| 628 | + foreach ($ldapObjects as $ldapObject) { |
|
| 629 | 629 | $nameByLDAP = null; |
| 630 | - if( isset($ldapObject[$nameAttribute]) |
|
| 630 | + if (isset($ldapObject[$nameAttribute]) |
|
| 631 | 631 | && is_array($ldapObject[$nameAttribute]) |
| 632 | 632 | && isset($ldapObject[$nameAttribute][0]) |
| 633 | 633 | ) { |
@@ -636,12 +636,12 @@ discard block |
||
| 636 | 636 | } |
| 637 | 637 | |
| 638 | 638 | $ncName = $this->dn2ocname($ldapObject['dn'][0], $nameByLDAP, $isUsers); |
| 639 | - if($ncName) { |
|
| 639 | + if ($ncName) { |
|
| 640 | 640 | $nextcloudNames[] = $ncName; |
| 641 | - if($isUsers) { |
|
| 641 | + if ($isUsers) { |
|
| 642 | 642 | //cache the user names so it does not need to be retrieved |
| 643 | 643 | //again later (e.g. sharing dialogue). |
| 644 | - if(is_null($nameByLDAP)) { |
|
| 644 | + if (is_null($nameByLDAP)) { |
|
| 645 | 645 | continue; |
| 646 | 646 | } |
| 647 | 647 | $sndName = isset($ldapObject[$sndAttribute][0]) |
@@ -679,7 +679,7 @@ discard block |
||
| 679 | 679 | */ |
| 680 | 680 | public function cacheUserDisplayName($ocName, $displayName, $displayName2 = '') { |
| 681 | 681 | $user = $this->userManager->get($ocName); |
| 682 | - if($user === null) { |
|
| 682 | + if ($user === null) { |
|
| 683 | 683 | return; |
| 684 | 684 | } |
| 685 | 685 | $displayName = $user->composeAndStoreDisplayName($displayName, $displayName2); |
@@ -699,9 +699,9 @@ discard block |
||
| 699 | 699 | $attempts = 0; |
| 700 | 700 | //while loop is just a precaution. If a name is not generated within |
| 701 | 701 | //20 attempts, something else is very wrong. Avoids infinite loop. |
| 702 | - while($attempts < 20){ |
|
| 703 | - $altName = $name . '_' . rand(1000,9999); |
|
| 704 | - if(!\OCP\User::userExists($altName)) { |
|
| 702 | + while ($attempts < 20) { |
|
| 703 | + $altName = $name.'_'.rand(1000, 9999); |
|
| 704 | + if (!\OCP\User::userExists($altName)) { |
|
| 705 | 705 | return $altName; |
| 706 | 706 | } |
| 707 | 707 | $attempts++; |
@@ -723,25 +723,25 @@ discard block |
||
| 723 | 723 | */ |
| 724 | 724 | private function _createAltInternalOwnCloudNameForGroups($name) { |
| 725 | 725 | $usedNames = $this->groupMapper->getNamesBySearch($name, "", '_%'); |
| 726 | - if(!($usedNames) || count($usedNames) === 0) { |
|
| 726 | + if (!($usedNames) || count($usedNames) === 0) { |
|
| 727 | 727 | $lastNo = 1; //will become name_2 |
| 728 | 728 | } else { |
| 729 | 729 | natsort($usedNames); |
| 730 | 730 | $lastName = array_pop($usedNames); |
| 731 | 731 | $lastNo = intval(substr($lastName, strrpos($lastName, '_') + 1)); |
| 732 | 732 | } |
| 733 | - $altName = $name.'_'.strval($lastNo+1); |
|
| 733 | + $altName = $name.'_'.strval($lastNo + 1); |
|
| 734 | 734 | unset($usedNames); |
| 735 | 735 | |
| 736 | 736 | $attempts = 1; |
| 737 | - while($attempts < 21){ |
|
| 737 | + while ($attempts < 21) { |
|
| 738 | 738 | // Check to be really sure it is unique |
| 739 | 739 | // while loop is just a precaution. If a name is not generated within |
| 740 | 740 | // 20 attempts, something else is very wrong. Avoids infinite loop. |
| 741 | - if(!\OC::$server->getGroupManager()->groupExists($altName)) { |
|
| 741 | + if (!\OC::$server->getGroupManager()->groupExists($altName)) { |
|
| 742 | 742 | return $altName; |
| 743 | 743 | } |
| 744 | - $altName = $name . '_' . ($lastNo + $attempts); |
|
| 744 | + $altName = $name.'_'.($lastNo + $attempts); |
|
| 745 | 745 | $attempts++; |
| 746 | 746 | } |
| 747 | 747 | return false; |
@@ -756,7 +756,7 @@ discard block |
||
| 756 | 756 | private function createAltInternalOwnCloudName($name, $isUser) { |
| 757 | 757 | $originalTTL = $this->connection->ldapCacheTTL; |
| 758 | 758 | $this->connection->setConfiguration(array('ldapCacheTTL' => 0)); |
| 759 | - if($isUser) { |
|
| 759 | + if ($isUser) { |
|
| 760 | 760 | $altName = $this->_createAltInternalOwnCloudNameForUsers($name); |
| 761 | 761 | } else { |
| 762 | 762 | $altName = $this->_createAltInternalOwnCloudNameForGroups($name); |
@@ -814,20 +814,20 @@ discard block |
||
| 814 | 814 | * and their values |
| 815 | 815 | * @param array $ldapRecords |
| 816 | 816 | */ |
| 817 | - public function batchApplyUserAttributes(array $ldapRecords){ |
|
| 817 | + public function batchApplyUserAttributes(array $ldapRecords) { |
|
| 818 | 818 | $displayNameAttribute = strtolower($this->connection->ldapUserDisplayName); |
| 819 | - foreach($ldapRecords as $userRecord) { |
|
| 820 | - if(!isset($userRecord[$displayNameAttribute])) { |
|
| 819 | + foreach ($ldapRecords as $userRecord) { |
|
| 820 | + if (!isset($userRecord[$displayNameAttribute])) { |
|
| 821 | 821 | // displayName is obligatory |
| 822 | 822 | continue; |
| 823 | 823 | } |
| 824 | - $ocName = $this->dn2ocname($userRecord['dn'][0]); |
|
| 825 | - if($ocName === false) { |
|
| 824 | + $ocName = $this->dn2ocname($userRecord['dn'][0]); |
|
| 825 | + if ($ocName === false) { |
|
| 826 | 826 | continue; |
| 827 | 827 | } |
| 828 | 828 | $this->cacheUserExists($ocName); |
| 829 | 829 | $user = $this->userManager->get($ocName); |
| 830 | - if($user instanceof OfflineUser) { |
|
| 830 | + if ($user instanceof OfflineUser) { |
|
| 831 | 831 | $user->unmark(); |
| 832 | 832 | $user = $this->userManager->get($ocName); |
| 833 | 833 | } |
@@ -859,8 +859,8 @@ discard block |
||
| 859 | 859 | * @return array |
| 860 | 860 | */ |
| 861 | 861 | private function fetchList($list, $manyAttributes) { |
| 862 | - if(is_array($list)) { |
|
| 863 | - if($manyAttributes) { |
|
| 862 | + if (is_array($list)) { |
|
| 863 | + if ($manyAttributes) { |
|
| 864 | 864 | return $list; |
| 865 | 865 | } else { |
| 866 | 866 | $list = array_reduce($list, function($carry, $item) { |
@@ -958,7 +958,7 @@ discard block |
||
| 958 | 958 | // php no longer supports call-time pass-by-reference |
| 959 | 959 | // thus cannot support controlPagedResultResponse as the third argument |
| 960 | 960 | // is a reference |
| 961 | - $doMethod = function () use ($command, &$arguments) { |
|
| 961 | + $doMethod = function() use ($command, &$arguments) { |
|
| 962 | 962 | if ($command == 'controlPagedResultResponse') { |
| 963 | 963 | throw new \InvalidArgumentException('Invoker does not support controlPagedResultResponse, call LDAP Wrapper directly instead.'); |
| 964 | 964 | } else { |
@@ -976,7 +976,7 @@ discard block |
||
| 976 | 976 | $this->connection->resetConnectionResource(); |
| 977 | 977 | $cr = $this->connection->getConnectionResource(); |
| 978 | 978 | |
| 979 | - if(!$this->ldap->isResource($cr)) { |
|
| 979 | + if (!$this->ldap->isResource($cr)) { |
|
| 980 | 980 | // Seems like we didn't find any resource. |
| 981 | 981 | \OCP\Util::writeLog('user_ldap', "Could not $command, because resource is missing.", \OCP\Util::DEBUG); |
| 982 | 982 | throw $e; |
@@ -997,13 +997,13 @@ discard block |
||
| 997 | 997 | * @throws \OC\ServerNotAvailableException |
| 998 | 998 | */ |
| 999 | 999 | private function executeSearch($filter, $base, &$attr = null, $limit = null, $offset = null) { |
| 1000 | - if(!is_null($attr) && !is_array($attr)) { |
|
| 1000 | + if (!is_null($attr) && !is_array($attr)) { |
|
| 1001 | 1001 | $attr = array(mb_strtolower($attr, 'UTF-8')); |
| 1002 | 1002 | } |
| 1003 | 1003 | |
| 1004 | 1004 | // See if we have a resource, in case not cancel with message |
| 1005 | 1005 | $cr = $this->connection->getConnectionResource(); |
| 1006 | - if(!$this->ldap->isResource($cr)) { |
|
| 1006 | + if (!$this->ldap->isResource($cr)) { |
|
| 1007 | 1007 | // Seems like we didn't find any resource. |
| 1008 | 1008 | // Return an empty array just like before. |
| 1009 | 1009 | \OCP\Util::writeLog('user_ldap', 'Could not search, because resource is missing.', \OCP\Util::DEBUG); |
@@ -1017,7 +1017,7 @@ discard block |
||
| 1017 | 1017 | $sr = $this->invokeLDAPMethod('search', $linkResources, $base, $filter, $attr); |
| 1018 | 1018 | // cannot use $cr anymore, might have changed in the previous call! |
| 1019 | 1019 | $error = $this->ldap->errno($this->connection->getConnectionResource()); |
| 1020 | - if(!is_array($sr) || $error !== 0) { |
|
| 1020 | + if (!is_array($sr) || $error !== 0) { |
|
| 1021 | 1021 | \OCP\Util::writeLog('user_ldap', 'Attempt for Paging? '.print_r($pagedSearchOK, true), \OCP\Util::ERROR); |
| 1022 | 1022 | return false; |
| 1023 | 1023 | } |
@@ -1040,26 +1040,26 @@ discard block |
||
| 1040 | 1040 | */ |
| 1041 | 1041 | private function processPagedSearchStatus($sr, $filter, $base, $iFoundItems, $limit, $offset, $pagedSearchOK, $skipHandling) { |
| 1042 | 1042 | $cookie = null; |
| 1043 | - if($pagedSearchOK) { |
|
| 1043 | + if ($pagedSearchOK) { |
|
| 1044 | 1044 | $cr = $this->connection->getConnectionResource(); |
| 1045 | - foreach($sr as $key => $res) { |
|
| 1046 | - if($this->ldap->controlPagedResultResponse($cr, $res, $cookie)) { |
|
| 1045 | + foreach ($sr as $key => $res) { |
|
| 1046 | + if ($this->ldap->controlPagedResultResponse($cr, $res, $cookie)) { |
|
| 1047 | 1047 | $this->setPagedResultCookie($base[$key], $filter, $limit, $offset, $cookie); |
| 1048 | 1048 | } |
| 1049 | 1049 | } |
| 1050 | 1050 | |
| 1051 | 1051 | //browsing through prior pages to get the cookie for the new one |
| 1052 | - if($skipHandling) { |
|
| 1052 | + if ($skipHandling) { |
|
| 1053 | 1053 | return false; |
| 1054 | 1054 | } |
| 1055 | 1055 | // if count is bigger, then the server does not support |
| 1056 | 1056 | // paged search. Instead, he did a normal search. We set a |
| 1057 | 1057 | // flag here, so the callee knows how to deal with it. |
| 1058 | - if($iFoundItems <= $limit) { |
|
| 1058 | + if ($iFoundItems <= $limit) { |
|
| 1059 | 1059 | $this->pagedSearchedSuccessful = true; |
| 1060 | 1060 | } |
| 1061 | 1061 | } else { |
| 1062 | - if(!is_null($limit)) { |
|
| 1062 | + if (!is_null($limit)) { |
|
| 1063 | 1063 | \OCP\Util::writeLog('user_ldap', 'Paged search was not available', \OCP\Util::INFO); |
| 1064 | 1064 | } |
| 1065 | 1065 | } |
@@ -1088,7 +1088,7 @@ discard block |
||
| 1088 | 1088 | \OCP\Util::writeLog('user_ldap', 'Count filter: '.print_r($filter, true), \OCP\Util::DEBUG); |
| 1089 | 1089 | |
| 1090 | 1090 | $limitPerPage = intval($this->connection->ldapPagingSize); |
| 1091 | - if(!is_null($limit) && $limit < $limitPerPage && $limit > 0) { |
|
| 1091 | + if (!is_null($limit) && $limit < $limitPerPage && $limit > 0) { |
|
| 1092 | 1092 | $limitPerPage = $limit; |
| 1093 | 1093 | } |
| 1094 | 1094 | |
@@ -1099,7 +1099,7 @@ discard block |
||
| 1099 | 1099 | do { |
| 1100 | 1100 | $search = $this->executeSearch($filter, $base, $attr, |
| 1101 | 1101 | $limitPerPage, $offset); |
| 1102 | - if($search === false) { |
|
| 1102 | + if ($search === false) { |
|
| 1103 | 1103 | return $counter > 0 ? $counter : false; |
| 1104 | 1104 | } |
| 1105 | 1105 | list($sr, $pagedSearchOK) = $search; |
@@ -1118,7 +1118,7 @@ discard block |
||
| 1118 | 1118 | * Continue now depends on $hasMorePages value |
| 1119 | 1119 | */ |
| 1120 | 1120 | $continue = $pagedSearchOK && $hasMorePages; |
| 1121 | - } while($continue && (is_null($limit) || $limit <= 0 || $limit > $counter)); |
|
| 1121 | + } while ($continue && (is_null($limit) || $limit <= 0 || $limit > $counter)); |
|
| 1122 | 1122 | |
| 1123 | 1123 | return $counter; |
| 1124 | 1124 | } |
@@ -1130,7 +1130,7 @@ discard block |
||
| 1130 | 1130 | private function countEntriesInSearchResults($searchResults) { |
| 1131 | 1131 | $counter = 0; |
| 1132 | 1132 | |
| 1133 | - foreach($searchResults as $res) { |
|
| 1133 | + foreach ($searchResults as $res) { |
|
| 1134 | 1134 | $count = intval($this->invokeLDAPMethod('countEntries', $this->connection->getConnectionResource(), $res)); |
| 1135 | 1135 | $counter += $count; |
| 1136 | 1136 | } |
@@ -1150,7 +1150,7 @@ discard block |
||
| 1150 | 1150 | */ |
| 1151 | 1151 | public function search($filter, $base, $attr = null, $limit = null, $offset = null, $skipHandling = false) { |
| 1152 | 1152 | $limitPerPage = intval($this->connection->ldapPagingSize); |
| 1153 | - if(!is_null($limit) && $limit < $limitPerPage && $limit > 0) { |
|
| 1153 | + if (!is_null($limit) && $limit < $limitPerPage && $limit > 0) { |
|
| 1154 | 1154 | $limitPerPage = $limit; |
| 1155 | 1155 | } |
| 1156 | 1156 | |
@@ -1164,13 +1164,13 @@ discard block |
||
| 1164 | 1164 | $savedoffset = $offset; |
| 1165 | 1165 | do { |
| 1166 | 1166 | $search = $this->executeSearch($filter, $base, $attr, $limitPerPage, $offset); |
| 1167 | - if($search === false) { |
|
| 1167 | + if ($search === false) { |
|
| 1168 | 1168 | return array(); |
| 1169 | 1169 | } |
| 1170 | 1170 | list($sr, $pagedSearchOK) = $search; |
| 1171 | 1171 | $cr = $this->connection->getConnectionResource(); |
| 1172 | 1172 | |
| 1173 | - if($skipHandling) { |
|
| 1173 | + if ($skipHandling) { |
|
| 1174 | 1174 | //i.e. result do not need to be fetched, we just need the cookie |
| 1175 | 1175 | //thus pass 1 or any other value as $iFoundItems because it is not |
| 1176 | 1176 | //used |
@@ -1181,7 +1181,7 @@ discard block |
||
| 1181 | 1181 | } |
| 1182 | 1182 | |
| 1183 | 1183 | $iFoundItems = 0; |
| 1184 | - foreach($sr as $res) { |
|
| 1184 | + foreach ($sr as $res) { |
|
| 1185 | 1185 | $findings = array_merge($findings, $this->invokeLDAPMethod('getEntries', $cr, $res)); |
| 1186 | 1186 | $iFoundItems = max($iFoundItems, $findings['count']); |
| 1187 | 1187 | unset($findings['count']); |
@@ -1197,25 +1197,25 @@ discard block |
||
| 1197 | 1197 | |
| 1198 | 1198 | // if we're here, probably no connection resource is returned. |
| 1199 | 1199 | // to make Nextcloud behave nicely, we simply give back an empty array. |
| 1200 | - if(is_null($findings)) { |
|
| 1200 | + if (is_null($findings)) { |
|
| 1201 | 1201 | return array(); |
| 1202 | 1202 | } |
| 1203 | 1203 | |
| 1204 | - if(!is_null($attr)) { |
|
| 1204 | + if (!is_null($attr)) { |
|
| 1205 | 1205 | $selection = array(); |
| 1206 | 1206 | $i = 0; |
| 1207 | - foreach($findings as $item) { |
|
| 1208 | - if(!is_array($item)) { |
|
| 1207 | + foreach ($findings as $item) { |
|
| 1208 | + if (!is_array($item)) { |
|
| 1209 | 1209 | continue; |
| 1210 | 1210 | } |
| 1211 | 1211 | $item = \OCP\Util::mb_array_change_key_case($item, MB_CASE_LOWER, 'UTF-8'); |
| 1212 | - foreach($attr as $key) { |
|
| 1212 | + foreach ($attr as $key) { |
|
| 1213 | 1213 | $key = mb_strtolower($key, 'UTF-8'); |
| 1214 | - if(isset($item[$key])) { |
|
| 1215 | - if(is_array($item[$key]) && isset($item[$key]['count'])) { |
|
| 1214 | + if (isset($item[$key])) { |
|
| 1215 | + if (is_array($item[$key]) && isset($item[$key]['count'])) { |
|
| 1216 | 1216 | unset($item[$key]['count']); |
| 1217 | 1217 | } |
| 1218 | - if($key !== 'dn') { |
|
| 1218 | + if ($key !== 'dn') { |
|
| 1219 | 1219 | $selection[$i][$key] = $this->resemblesDN($key) ? |
| 1220 | 1220 | $this->helper->sanitizeDN($item[$key]) |
| 1221 | 1221 | : $item[$key]; |
@@ -1232,7 +1232,7 @@ discard block |
||
| 1232 | 1232 | //we slice the findings, when |
| 1233 | 1233 | //a) paged search unsuccessful, though attempted |
| 1234 | 1234 | //b) no paged search, but limit set |
| 1235 | - if((!$this->getPagedSearchResultState() |
|
| 1235 | + if ((!$this->getPagedSearchResultState() |
|
| 1236 | 1236 | && $pagedSearchOK) |
| 1237 | 1237 | || ( |
| 1238 | 1238 | !$pagedSearchOK |
@@ -1249,7 +1249,7 @@ discard block |
||
| 1249 | 1249 | * @return bool|mixed|string |
| 1250 | 1250 | */ |
| 1251 | 1251 | public function sanitizeUsername($name) { |
| 1252 | - if($this->connection->ldapIgnoreNamingRules) { |
|
| 1252 | + if ($this->connection->ldapIgnoreNamingRules) { |
|
| 1253 | 1253 | return $name; |
| 1254 | 1254 | } |
| 1255 | 1255 | |
@@ -1274,13 +1274,13 @@ discard block |
||
| 1274 | 1274 | */ |
| 1275 | 1275 | public function escapeFilterPart($input, $allowAsterisk = false) { |
| 1276 | 1276 | $asterisk = ''; |
| 1277 | - if($allowAsterisk && strlen($input) > 0 && $input[0] === '*') { |
|
| 1277 | + if ($allowAsterisk && strlen($input) > 0 && $input[0] === '*') { |
|
| 1278 | 1278 | $asterisk = '*'; |
| 1279 | 1279 | $input = mb_substr($input, 1, null, 'UTF-8'); |
| 1280 | 1280 | } |
| 1281 | 1281 | $search = array('*', '\\', '(', ')'); |
| 1282 | 1282 | $replace = array('\\*', '\\\\', '\\(', '\\)'); |
| 1283 | - return $asterisk . str_replace($search, $replace, $input); |
|
| 1283 | + return $asterisk.str_replace($search, $replace, $input); |
|
| 1284 | 1284 | } |
| 1285 | 1285 | |
| 1286 | 1286 | /** |
@@ -1310,13 +1310,13 @@ discard block |
||
| 1310 | 1310 | */ |
| 1311 | 1311 | private function combineFilter($filters, $operator) { |
| 1312 | 1312 | $combinedFilter = '('.$operator; |
| 1313 | - foreach($filters as $filter) { |
|
| 1313 | + foreach ($filters as $filter) { |
|
| 1314 | 1314 | if ($filter !== '' && $filter[0] !== '(') { |
| 1315 | 1315 | $filter = '('.$filter.')'; |
| 1316 | 1316 | } |
| 1317 | - $combinedFilter.=$filter; |
|
| 1317 | + $combinedFilter .= $filter; |
|
| 1318 | 1318 | } |
| 1319 | - $combinedFilter.=')'; |
|
| 1319 | + $combinedFilter .= ')'; |
|
| 1320 | 1320 | return $combinedFilter; |
| 1321 | 1321 | } |
| 1322 | 1322 | |
@@ -1352,17 +1352,17 @@ discard block |
||
| 1352 | 1352 | * @throws \Exception |
| 1353 | 1353 | */ |
| 1354 | 1354 | private function getAdvancedFilterPartForSearch($search, $searchAttributes) { |
| 1355 | - if(!is_array($searchAttributes) || count($searchAttributes) < 2) { |
|
| 1355 | + if (!is_array($searchAttributes) || count($searchAttributes) < 2) { |
|
| 1356 | 1356 | throw new \Exception('searchAttributes must be an array with at least two string'); |
| 1357 | 1357 | } |
| 1358 | 1358 | $searchWords = explode(' ', trim($search)); |
| 1359 | 1359 | $wordFilters = array(); |
| 1360 | - foreach($searchWords as $word) { |
|
| 1360 | + foreach ($searchWords as $word) { |
|
| 1361 | 1361 | $word = $this->prepareSearchTerm($word); |
| 1362 | 1362 | //every word needs to appear at least once |
| 1363 | 1363 | $wordMatchOneAttrFilters = array(); |
| 1364 | - foreach($searchAttributes as $attr) { |
|
| 1365 | - $wordMatchOneAttrFilters[] = $attr . '=' . $word; |
|
| 1364 | + foreach ($searchAttributes as $attr) { |
|
| 1365 | + $wordMatchOneAttrFilters[] = $attr.'='.$word; |
|
| 1366 | 1366 | } |
| 1367 | 1367 | $wordFilters[] = $this->combineFilterWithOr($wordMatchOneAttrFilters); |
| 1368 | 1368 | } |
@@ -1380,10 +1380,10 @@ discard block |
||
| 1380 | 1380 | private function getFilterPartForSearch($search, $searchAttributes, $fallbackAttribute) { |
| 1381 | 1381 | $filter = array(); |
| 1382 | 1382 | $haveMultiSearchAttributes = (is_array($searchAttributes) && count($searchAttributes) > 0); |
| 1383 | - if($haveMultiSearchAttributes && strpos(trim($search), ' ') !== false) { |
|
| 1383 | + if ($haveMultiSearchAttributes && strpos(trim($search), ' ') !== false) { |
|
| 1384 | 1384 | try { |
| 1385 | 1385 | return $this->getAdvancedFilterPartForSearch($search, $searchAttributes); |
| 1386 | - } catch(\Exception $e) { |
|
| 1386 | + } catch (\Exception $e) { |
|
| 1387 | 1387 | \OCP\Util::writeLog( |
| 1388 | 1388 | 'user_ldap', |
| 1389 | 1389 | 'Creating advanced filter for search failed, falling back to simple method.', |
@@ -1393,17 +1393,17 @@ discard block |
||
| 1393 | 1393 | } |
| 1394 | 1394 | |
| 1395 | 1395 | $search = $this->prepareSearchTerm($search); |
| 1396 | - if(!is_array($searchAttributes) || count($searchAttributes) === 0) { |
|
| 1396 | + if (!is_array($searchAttributes) || count($searchAttributes) === 0) { |
|
| 1397 | 1397 | if ($fallbackAttribute === '') { |
| 1398 | 1398 | return ''; |
| 1399 | 1399 | } |
| 1400 | - $filter[] = $fallbackAttribute . '=' . $search; |
|
| 1400 | + $filter[] = $fallbackAttribute.'='.$search; |
|
| 1401 | 1401 | } else { |
| 1402 | - foreach($searchAttributes as $attribute) { |
|
| 1403 | - $filter[] = $attribute . '=' . $search; |
|
| 1402 | + foreach ($searchAttributes as $attribute) { |
|
| 1403 | + $filter[] = $attribute.'='.$search; |
|
| 1404 | 1404 | } |
| 1405 | 1405 | } |
| 1406 | - if(count($filter) === 1) { |
|
| 1406 | + if (count($filter) === 1) { |
|
| 1407 | 1407 | return '('.$filter[0].')'; |
| 1408 | 1408 | } |
| 1409 | 1409 | return $this->combineFilterWithOr($filter); |
@@ -1424,7 +1424,7 @@ discard block |
||
| 1424 | 1424 | if ($term === '') { |
| 1425 | 1425 | $result = '*'; |
| 1426 | 1426 | } else if ($allowEnum !== 'no') { |
| 1427 | - $result = $term . '*'; |
|
| 1427 | + $result = $term.'*'; |
|
| 1428 | 1428 | } |
| 1429 | 1429 | return $result; |
| 1430 | 1430 | } |
@@ -1436,7 +1436,7 @@ discard block |
||
| 1436 | 1436 | public function getFilterForUserCount() { |
| 1437 | 1437 | $filter = $this->combineFilterWithAnd(array( |
| 1438 | 1438 | $this->connection->ldapUserFilter, |
| 1439 | - $this->connection->ldapUserDisplayName . '=*' |
|
| 1439 | + $this->connection->ldapUserDisplayName.'=*' |
|
| 1440 | 1440 | )); |
| 1441 | 1441 | |
| 1442 | 1442 | return $filter; |
@@ -1454,7 +1454,7 @@ discard block |
||
| 1454 | 1454 | 'ldapAgentName' => $name, |
| 1455 | 1455 | 'ldapAgentPassword' => $password |
| 1456 | 1456 | ); |
| 1457 | - if(!$testConnection->setConfiguration($credentials)) { |
|
| 1457 | + if (!$testConnection->setConfiguration($credentials)) { |
|
| 1458 | 1458 | return false; |
| 1459 | 1459 | } |
| 1460 | 1460 | return $testConnection->bind(); |
@@ -1476,30 +1476,30 @@ discard block |
||
| 1476 | 1476 | // Sacrebleu! The UUID attribute is unknown :( We need first an |
| 1477 | 1477 | // existing DN to be able to reliably detect it. |
| 1478 | 1478 | $result = $this->search($filter, $base, ['dn'], 1); |
| 1479 | - if(!isset($result[0]) || !isset($result[0]['dn'])) { |
|
| 1479 | + if (!isset($result[0]) || !isset($result[0]['dn'])) { |
|
| 1480 | 1480 | throw new \Exception('Cannot determine UUID attribute'); |
| 1481 | 1481 | } |
| 1482 | 1482 | $dn = $result[0]['dn'][0]; |
| 1483 | - if(!$this->detectUuidAttribute($dn, true)) { |
|
| 1483 | + if (!$this->detectUuidAttribute($dn, true)) { |
|
| 1484 | 1484 | throw new \Exception('Cannot determine UUID attribute'); |
| 1485 | 1485 | } |
| 1486 | 1486 | } else { |
| 1487 | 1487 | // The UUID attribute is either known or an override is given. |
| 1488 | 1488 | // By calling this method we ensure that $this->connection->$uuidAttr |
| 1489 | 1489 | // is definitely set |
| 1490 | - if(!$this->detectUuidAttribute('', true)) { |
|
| 1490 | + if (!$this->detectUuidAttribute('', true)) { |
|
| 1491 | 1491 | throw new \Exception('Cannot determine UUID attribute'); |
| 1492 | 1492 | } |
| 1493 | 1493 | } |
| 1494 | 1494 | |
| 1495 | 1495 | $uuidAttr = $this->connection->ldapUuidUserAttribute; |
| 1496 | - if($uuidAttr === 'guid' || $uuidAttr === 'objectguid') { |
|
| 1496 | + if ($uuidAttr === 'guid' || $uuidAttr === 'objectguid') { |
|
| 1497 | 1497 | $uuid = $this->formatGuid2ForFilterUser($uuid); |
| 1498 | 1498 | } |
| 1499 | 1499 | |
| 1500 | - $filter = $uuidAttr . '=' . $uuid; |
|
| 1500 | + $filter = $uuidAttr.'='.$uuid; |
|
| 1501 | 1501 | $result = $this->searchUsers($filter, ['dn'], 2); |
| 1502 | - if(is_array($result) && isset($result[0]) && isset($result[0]['dn']) && count($result) === 1) { |
|
| 1502 | + if (is_array($result) && isset($result[0]) && isset($result[0]['dn']) && count($result) === 1) { |
|
| 1503 | 1503 | // we put the count into account to make sure that this is |
| 1504 | 1504 | // really unique |
| 1505 | 1505 | return $result[0]['dn'][0]; |
@@ -1516,7 +1516,7 @@ discard block |
||
| 1516 | 1516 | * @return bool true on success, false otherwise |
| 1517 | 1517 | */ |
| 1518 | 1518 | private function detectUuidAttribute($dn, $isUser = true, $force = false) { |
| 1519 | - if($isUser) { |
|
| 1519 | + if ($isUser) { |
|
| 1520 | 1520 | $uuidAttr = 'ldapUuidUserAttribute'; |
| 1521 | 1521 | $uuidOverride = $this->connection->ldapExpertUUIDUserAttr; |
| 1522 | 1522 | } else { |
@@ -1524,7 +1524,7 @@ discard block |
||
| 1524 | 1524 | $uuidOverride = $this->connection->ldapExpertUUIDGroupAttr; |
| 1525 | 1525 | } |
| 1526 | 1526 | |
| 1527 | - if(($this->connection->$uuidAttr !== 'auto') && !$force) { |
|
| 1527 | + if (($this->connection->$uuidAttr !== 'auto') && !$force) { |
|
| 1528 | 1528 | return true; |
| 1529 | 1529 | } |
| 1530 | 1530 | |
@@ -1536,9 +1536,9 @@ discard block |
||
| 1536 | 1536 | // for now, supported attributes are entryUUID, nsuniqueid, objectGUID, ipaUniqueID |
| 1537 | 1537 | $testAttributes = array('entryuuid', 'nsuniqueid', 'objectguid', 'guid', 'ipauniqueid'); |
| 1538 | 1538 | |
| 1539 | - foreach($testAttributes as $attribute) { |
|
| 1539 | + foreach ($testAttributes as $attribute) { |
|
| 1540 | 1540 | $value = $this->readAttribute($dn, $attribute); |
| 1541 | - if(is_array($value) && isset($value[0]) && !empty($value[0])) { |
|
| 1541 | + if (is_array($value) && isset($value[0]) && !empty($value[0])) { |
|
| 1542 | 1542 | \OCP\Util::writeLog('user_ldap', |
| 1543 | 1543 | 'Setting '.$attribute.' as '.$uuidAttr, |
| 1544 | 1544 | \OCP\Util::DEBUG); |
@@ -1559,7 +1559,7 @@ discard block |
||
| 1559 | 1559 | * @return string|bool |
| 1560 | 1560 | */ |
| 1561 | 1561 | public function getUUID($dn, $isUser = true) { |
| 1562 | - if($isUser) { |
|
| 1562 | + if ($isUser) { |
|
| 1563 | 1563 | $uuidAttr = 'ldapUuidUserAttribute'; |
| 1564 | 1564 | $uuidOverride = $this->connection->ldapExpertUUIDUserAttr; |
| 1565 | 1565 | } else { |
@@ -1568,15 +1568,15 @@ discard block |
||
| 1568 | 1568 | } |
| 1569 | 1569 | |
| 1570 | 1570 | $uuid = false; |
| 1571 | - if($this->detectUuidAttribute($dn, $isUser)) { |
|
| 1571 | + if ($this->detectUuidAttribute($dn, $isUser)) { |
|
| 1572 | 1572 | $uuid = $this->readAttribute($dn, $this->connection->$uuidAttr); |
| 1573 | - if( !is_array($uuid) |
|
| 1573 | + if (!is_array($uuid) |
|
| 1574 | 1574 | && $uuidOverride !== '' |
| 1575 | 1575 | && $this->detectUuidAttribute($dn, $isUser, true)) { |
| 1576 | 1576 | $uuid = $this->readAttribute($dn, |
| 1577 | 1577 | $this->connection->$uuidAttr); |
| 1578 | 1578 | } |
| 1579 | - if(is_array($uuid) && isset($uuid[0]) && !empty($uuid[0])) { |
|
| 1579 | + if (is_array($uuid) && isset($uuid[0]) && !empty($uuid[0])) { |
|
| 1580 | 1580 | $uuid = $uuid[0]; |
| 1581 | 1581 | } |
| 1582 | 1582 | } |
@@ -1593,19 +1593,19 @@ discard block |
||
| 1593 | 1593 | private function convertObjectGUID2Str($oguid) { |
| 1594 | 1594 | $hex_guid = bin2hex($oguid); |
| 1595 | 1595 | $hex_guid_to_guid_str = ''; |
| 1596 | - for($k = 1; $k <= 4; ++$k) { |
|
| 1596 | + for ($k = 1; $k <= 4; ++$k) { |
|
| 1597 | 1597 | $hex_guid_to_guid_str .= substr($hex_guid, 8 - 2 * $k, 2); |
| 1598 | 1598 | } |
| 1599 | 1599 | $hex_guid_to_guid_str .= '-'; |
| 1600 | - for($k = 1; $k <= 2; ++$k) { |
|
| 1600 | + for ($k = 1; $k <= 2; ++$k) { |
|
| 1601 | 1601 | $hex_guid_to_guid_str .= substr($hex_guid, 12 - 2 * $k, 2); |
| 1602 | 1602 | } |
| 1603 | 1603 | $hex_guid_to_guid_str .= '-'; |
| 1604 | - for($k = 1; $k <= 2; ++$k) { |
|
| 1604 | + for ($k = 1; $k <= 2; ++$k) { |
|
| 1605 | 1605 | $hex_guid_to_guid_str .= substr($hex_guid, 16 - 2 * $k, 2); |
| 1606 | 1606 | } |
| 1607 | - $hex_guid_to_guid_str .= '-' . substr($hex_guid, 16, 4); |
|
| 1608 | - $hex_guid_to_guid_str .= '-' . substr($hex_guid, 20); |
|
| 1607 | + $hex_guid_to_guid_str .= '-'.substr($hex_guid, 16, 4); |
|
| 1608 | + $hex_guid_to_guid_str .= '-'.substr($hex_guid, 20); |
|
| 1609 | 1609 | |
| 1610 | 1610 | return strtoupper($hex_guid_to_guid_str); |
| 1611 | 1611 | } |
@@ -1622,11 +1622,11 @@ discard block |
||
| 1622 | 1622 | * @return string |
| 1623 | 1623 | */ |
| 1624 | 1624 | public function formatGuid2ForFilterUser($guid) { |
| 1625 | - if(!is_string($guid)) { |
|
| 1625 | + if (!is_string($guid)) { |
|
| 1626 | 1626 | throw new \InvalidArgumentException('String expected'); |
| 1627 | 1627 | } |
| 1628 | 1628 | $blocks = explode('-', $guid); |
| 1629 | - if(count($blocks) !== 5) { |
|
| 1629 | + if (count($blocks) !== 5) { |
|
| 1630 | 1630 | /* |
| 1631 | 1631 | * Why not throw an Exception instead? This method is a utility |
| 1632 | 1632 | * called only when trying to figure out whether a "missing" known |
@@ -1639,20 +1639,20 @@ discard block |
||
| 1639 | 1639 | * user. Instead we write a log message. |
| 1640 | 1640 | */ |
| 1641 | 1641 | \OC::$server->getLogger()->info( |
| 1642 | - 'Passed string does not resemble a valid GUID. Known UUID ' . |
|
| 1642 | + 'Passed string does not resemble a valid GUID. Known UUID '. |
|
| 1643 | 1643 | '({uuid}) probably does not match UUID configuration.', |
| 1644 | - [ 'app' => 'user_ldap', 'uuid' => $guid ] |
|
| 1644 | + ['app' => 'user_ldap', 'uuid' => $guid] |
|
| 1645 | 1645 | ); |
| 1646 | 1646 | return $guid; |
| 1647 | 1647 | } |
| 1648 | - for($i=0; $i < 3; $i++) { |
|
| 1648 | + for ($i = 0; $i < 3; $i++) { |
|
| 1649 | 1649 | $pairs = str_split($blocks[$i], 2); |
| 1650 | 1650 | $pairs = array_reverse($pairs); |
| 1651 | 1651 | $blocks[$i] = implode('', $pairs); |
| 1652 | 1652 | } |
| 1653 | - for($i=0; $i < 5; $i++) { |
|
| 1653 | + for ($i = 0; $i < 5; $i++) { |
|
| 1654 | 1654 | $pairs = str_split($blocks[$i], 2); |
| 1655 | - $blocks[$i] = '\\' . implode('\\', $pairs); |
|
| 1655 | + $blocks[$i] = '\\'.implode('\\', $pairs); |
|
| 1656 | 1656 | } |
| 1657 | 1657 | return implode('', $blocks); |
| 1658 | 1658 | } |
@@ -1666,12 +1666,12 @@ discard block |
||
| 1666 | 1666 | $domainDN = $this->getDomainDNFromDN($dn); |
| 1667 | 1667 | $cacheKey = 'getSID-'.$domainDN; |
| 1668 | 1668 | $sid = $this->connection->getFromCache($cacheKey); |
| 1669 | - if(!is_null($sid)) { |
|
| 1669 | + if (!is_null($sid)) { |
|
| 1670 | 1670 | return $sid; |
| 1671 | 1671 | } |
| 1672 | 1672 | |
| 1673 | 1673 | $objectSid = $this->readAttribute($domainDN, 'objectsid'); |
| 1674 | - if(!is_array($objectSid) || empty($objectSid)) { |
|
| 1674 | + if (!is_array($objectSid) || empty($objectSid)) { |
|
| 1675 | 1675 | $this->connection->writeToCache($cacheKey, false); |
| 1676 | 1676 | return false; |
| 1677 | 1677 | } |
@@ -1729,12 +1729,12 @@ discard block |
||
| 1729 | 1729 | $belongsToBase = false; |
| 1730 | 1730 | $bases = $this->helper->sanitizeDN($bases); |
| 1731 | 1731 | |
| 1732 | - foreach($bases as $base) { |
|
| 1732 | + foreach ($bases as $base) { |
|
| 1733 | 1733 | $belongsToBase = true; |
| 1734 | - if(mb_strripos($dn, $base, 0, 'UTF-8') !== (mb_strlen($dn, 'UTF-8')-mb_strlen($base, 'UTF-8'))) { |
|
| 1734 | + if (mb_strripos($dn, $base, 0, 'UTF-8') !== (mb_strlen($dn, 'UTF-8') - mb_strlen($base, 'UTF-8'))) { |
|
| 1735 | 1735 | $belongsToBase = false; |
| 1736 | 1736 | } |
| 1737 | - if($belongsToBase) { |
|
| 1737 | + if ($belongsToBase) { |
|
| 1738 | 1738 | break; |
| 1739 | 1739 | } |
| 1740 | 1740 | } |
@@ -1745,7 +1745,7 @@ discard block |
||
| 1745 | 1745 | * resets a running Paged Search operation |
| 1746 | 1746 | */ |
| 1747 | 1747 | private function abandonPagedSearch() { |
| 1748 | - if($this->connection->hasPagedResultSupport) { |
|
| 1748 | + if ($this->connection->hasPagedResultSupport) { |
|
| 1749 | 1749 | $cr = $this->connection->getConnectionResource(); |
| 1750 | 1750 | $this->invokeLDAPMethod('controlPagedResult', $cr, 0, false, $this->lastCookie); |
| 1751 | 1751 | $this->getPagedSearchResultState(); |
@@ -1763,16 +1763,16 @@ discard block |
||
| 1763 | 1763 | * @return string containing the key or empty if none is cached |
| 1764 | 1764 | */ |
| 1765 | 1765 | private function getPagedResultCookie($base, $filter, $limit, $offset) { |
| 1766 | - if($offset === 0) { |
|
| 1766 | + if ($offset === 0) { |
|
| 1767 | 1767 | return ''; |
| 1768 | 1768 | } |
| 1769 | 1769 | $offset -= $limit; |
| 1770 | 1770 | //we work with cache here |
| 1771 | - $cacheKey = 'lc' . crc32($base) . '-' . crc32($filter) . '-' . intval($limit) . '-' . intval($offset); |
|
| 1771 | + $cacheKey = 'lc'.crc32($base).'-'.crc32($filter).'-'.intval($limit).'-'.intval($offset); |
|
| 1772 | 1772 | $cookie = ''; |
| 1773 | - if(isset($this->cookies[$cacheKey])) { |
|
| 1773 | + if (isset($this->cookies[$cacheKey])) { |
|
| 1774 | 1774 | $cookie = $this->cookies[$cacheKey]; |
| 1775 | - if(is_null($cookie)) { |
|
| 1775 | + if (is_null($cookie)) { |
|
| 1776 | 1776 | $cookie = ''; |
| 1777 | 1777 | } |
| 1778 | 1778 | } |
@@ -1790,11 +1790,11 @@ discard block |
||
| 1790 | 1790 | * @return bool |
| 1791 | 1791 | */ |
| 1792 | 1792 | public function hasMoreResults() { |
| 1793 | - if(!$this->connection->hasPagedResultSupport) { |
|
| 1793 | + if (!$this->connection->hasPagedResultSupport) { |
|
| 1794 | 1794 | return false; |
| 1795 | 1795 | } |
| 1796 | 1796 | |
| 1797 | - if(empty($this->lastCookie) && $this->lastCookie !== '0') { |
|
| 1797 | + if (empty($this->lastCookie) && $this->lastCookie !== '0') { |
|
| 1798 | 1798 | // as in RFC 2696, when all results are returned, the cookie will |
| 1799 | 1799 | // be empty. |
| 1800 | 1800 | return false; |
@@ -1814,8 +1814,8 @@ discard block |
||
| 1814 | 1814 | */ |
| 1815 | 1815 | private function setPagedResultCookie($base, $filter, $limit, $offset, $cookie) { |
| 1816 | 1816 | // allow '0' for 389ds |
| 1817 | - if(!empty($cookie) || $cookie === '0') { |
|
| 1818 | - $cacheKey = 'lc' . crc32($base) . '-' . crc32($filter) . '-' .intval($limit) . '-' . intval($offset); |
|
| 1817 | + if (!empty($cookie) || $cookie === '0') { |
|
| 1818 | + $cacheKey = 'lc'.crc32($base).'-'.crc32($filter).'-'.intval($limit).'-'.intval($offset); |
|
| 1819 | 1819 | $this->cookies[$cacheKey] = $cookie; |
| 1820 | 1820 | $this->lastCookie = $cookie; |
| 1821 | 1821 | } |
@@ -1842,22 +1842,22 @@ discard block |
||
| 1842 | 1842 | */ |
| 1843 | 1843 | private function initPagedSearch($filter, $bases, $attr, $limit, $offset) { |
| 1844 | 1844 | $pagedSearchOK = false; |
| 1845 | - if($this->connection->hasPagedResultSupport && ($limit !== 0)) { |
|
| 1845 | + if ($this->connection->hasPagedResultSupport && ($limit !== 0)) { |
|
| 1846 | 1846 | $offset = intval($offset); //can be null |
| 1847 | 1847 | \OCP\Util::writeLog('user_ldap', |
| 1848 | 1848 | 'initializing paged search for Filter '.$filter.' base '.print_r($bases, true) |
| 1849 | - .' attr '.print_r($attr, true). ' limit ' .$limit.' offset '.$offset, |
|
| 1849 | + .' attr '.print_r($attr, true).' limit '.$limit.' offset '.$offset, |
|
| 1850 | 1850 | \OCP\Util::DEBUG); |
| 1851 | 1851 | //get the cookie from the search for the previous search, required by LDAP |
| 1852 | - foreach($bases as $base) { |
|
| 1852 | + foreach ($bases as $base) { |
|
| 1853 | 1853 | |
| 1854 | 1854 | $cookie = $this->getPagedResultCookie($base, $filter, $limit, $offset); |
| 1855 | - if(empty($cookie) && $cookie !== "0" && ($offset > 0)) { |
|
| 1855 | + if (empty($cookie) && $cookie !== "0" && ($offset > 0)) { |
|
| 1856 | 1856 | // no cookie known from a potential previous search. We need |
| 1857 | 1857 | // to start from 0 to come to the desired page. cookie value |
| 1858 | 1858 | // of '0' is valid, because 389ds |
| 1859 | 1859 | $reOffset = 0; |
| 1860 | - while($reOffset < $offset) { |
|
| 1860 | + while ($reOffset < $offset) { |
|
| 1861 | 1861 | $this->search($filter, array($base), $attr, $limit, $reOffset, true); |
| 1862 | 1862 | $reOffset += $limit; |
| 1863 | 1863 | } |
@@ -1865,17 +1865,17 @@ discard block |
||
| 1865 | 1865 | //still no cookie? obviously, the server does not like us. Let's skip paging efforts. |
| 1866 | 1866 | // '0' is valid, because 389ds |
| 1867 | 1867 | //TODO: remember this, probably does not change in the next request... |
| 1868 | - if(empty($cookie) && $cookie !== '0') { |
|
| 1868 | + if (empty($cookie) && $cookie !== '0') { |
|
| 1869 | 1869 | $cookie = null; |
| 1870 | 1870 | } |
| 1871 | 1871 | } |
| 1872 | - if(!is_null($cookie)) { |
|
| 1872 | + if (!is_null($cookie)) { |
|
| 1873 | 1873 | //since offset = 0, this is a new search. We abandon other searches that might be ongoing. |
| 1874 | 1874 | $this->abandonPagedSearch(); |
| 1875 | 1875 | $pagedSearchOK = $this->invokeLDAPMethod('controlPagedResult', |
| 1876 | 1876 | $this->connection->getConnectionResource(), $limit, |
| 1877 | 1877 | false, $cookie); |
| 1878 | - if(!$pagedSearchOK) { |
|
| 1878 | + if (!$pagedSearchOK) { |
|
| 1879 | 1879 | return false; |
| 1880 | 1880 | } |
| 1881 | 1881 | \OCP\Util::writeLog('user_ldap', 'Ready for a paged search', \OCP\Util::DEBUG); |
@@ -1892,7 +1892,7 @@ discard block |
||
| 1892 | 1892 | * So we added "&& !empty($this->lastCookie)" to this test to ignore pagination |
| 1893 | 1893 | * if we don't have a previous paged search. |
| 1894 | 1894 | */ |
| 1895 | - } else if($this->connection->hasPagedResultSupport && $limit === 0 && !empty($this->lastCookie)) { |
|
| 1895 | + } else if ($this->connection->hasPagedResultSupport && $limit === 0 && !empty($this->lastCookie)) { |
|
| 1896 | 1896 | // a search without limit was requested. However, if we do use |
| 1897 | 1897 | // Paged Search once, we always must do it. This requires us to |
| 1898 | 1898 | // initialize it with the configured page size. |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | public function extend(array $settings) { |
| 38 | 38 | $appConfig = json_decode($settings['array']['oc_appconfig'], true); |
| 39 | 39 | |
| 40 | - $value = (int)$this->c->getConfig()->getAppValue('comments', 'maxAutoCompleteResults', 10); |
|
| 40 | + $value = (int) $this->c->getConfig()->getAppValue('comments', 'maxAutoCompleteResults', 10); |
|
| 41 | 41 | $appConfig['comments']['maxAutoCompleteResults'] = $value; |
| 42 | 42 | |
| 43 | 43 | $settings['array']['oc_appconfig'] = json_encode($appConfig); |
@@ -52,23 +52,23 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | public function sort(array &$sortArray, array $context) { |
| 54 | 54 | // let's be tolerant. Comments uses "files" by default, other usages are often singular |
| 55 | - if($context['itemType'] !== 'files' && $context['itemType'] !== 'file') { |
|
| 55 | + if ($context['itemType'] !== 'files' && $context['itemType'] !== 'file') { |
|
| 56 | 56 | return; |
| 57 | 57 | } |
| 58 | 58 | $user = $this->userSession->getUser(); |
| 59 | - if($user === null) { |
|
| 59 | + if ($user === null) { |
|
| 60 | 60 | return; |
| 61 | 61 | } |
| 62 | 62 | $userFolder = $this->rootFolder->getUserFolder($user->getUID()); |
| 63 | 63 | /** @var Node[] $nodes */ |
| 64 | - $nodes = $userFolder->getById((int)$context['itemId']); |
|
| 65 | - if(count($nodes) === 0) { |
|
| 64 | + $nodes = $userFolder->getById((int) $context['itemId']); |
|
| 65 | + if (count($nodes) === 0) { |
|
| 66 | 66 | return; |
| 67 | 67 | } |
| 68 | 68 | $al = $this->shareManager->getAccessList($nodes[0]); |
| 69 | 69 | |
| 70 | 70 | foreach ($sortArray as $type => &$byType) { |
| 71 | - if(!isset($al[$type]) || !is_array($al[$type])) { |
|
| 71 | + if (!isset($al[$type]) || !is_array($al[$type])) { |
|
| 72 | 72 | continue; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -79,9 +79,9 @@ discard block |
||
| 79 | 79 | return [$i++, $element]; |
| 80 | 80 | }, $byType); |
| 81 | 81 | |
| 82 | - usort($workArray, function ($a, $b) use ($al, $type) { |
|
| 82 | + usort($workArray, function($a, $b) use ($al, $type) { |
|
| 83 | 83 | $result = $this->compare($a[1], $b[1], $al[$type]); |
| 84 | - if($result === 0) { |
|
| 84 | + if ($result === 0) { |
|
| 85 | 85 | $result = $a[0] - $b[0]; |
| 86 | 86 | } |
| 87 | 87 | return $result; |
@@ -102,8 +102,8 @@ discard block |
||
| 102 | 102 | $a = $a['value']['shareWith']; |
| 103 | 103 | $b = $b['value']['shareWith']; |
| 104 | 104 | |
| 105 | - $valueA = (int)in_array($a, $al, true); |
|
| 106 | - $valueB = (int)in_array($b, $al, true); |
|
| 105 | + $valueA = (int) in_array($a, $al, true); |
|
| 106 | + $valueB = (int) in_array($b, $al, true); |
|
| 107 | 107 | |
| 108 | 108 | return $valueB - $valueA; |
| 109 | 109 | } |
@@ -49,12 +49,12 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function sort(array &$sortArray, array $context) { |
| 51 | 51 | $commenters = $this->retrieveCommentsInformation($context['itemType'], $context['itemId']); |
| 52 | - if(count($commenters) === 0) { |
|
| 52 | + if (count($commenters) === 0) { |
|
| 53 | 53 | return; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | foreach ($sortArray as $type => &$byType) { |
| 57 | - if(!isset($commenters[$type])) { |
|
| 57 | + if (!isset($commenters[$type])) { |
|
| 58 | 58 | continue; |
| 59 | 59 | } |
| 60 | 60 | |
@@ -65,9 +65,9 @@ discard block |
||
| 65 | 65 | return [$i++, $element]; |
| 66 | 66 | }, $byType); |
| 67 | 67 | |
| 68 | - usort($workArray, function ($a, $b) use ($commenters, $type) { |
|
| 68 | + usort($workArray, function($a, $b) use ($commenters, $type) { |
|
| 69 | 69 | $r = $this->compare($a[1], $b[1], $commenters[$type]); |
| 70 | - if($r === 0) { |
|
| 70 | + if ($r === 0) { |
|
| 71 | 71 | $r = $a[0] - $b[0]; |
| 72 | 72 | } |
| 73 | 73 | return $r; |
@@ -85,16 +85,16 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | protected function retrieveCommentsInformation($type, $id) { |
| 87 | 87 | $comments = $this->commentsManager->getForObject($type, $id); |
| 88 | - if(count($comments) === 0) { |
|
| 88 | + if (count($comments) === 0) { |
|
| 89 | 89 | return []; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | $actors = []; |
| 93 | 93 | foreach ($comments as $comment) { |
| 94 | - if(!isset($actors[$comment->getActorType()])) { |
|
| 94 | + if (!isset($actors[$comment->getActorType()])) { |
|
| 95 | 95 | $actors[$comment->getActorType()] = []; |
| 96 | 96 | } |
| 97 | - if(!isset($actors[$comment->getActorType()][$comment->getActorId()])) { |
|
| 97 | + if (!isset($actors[$comment->getActorType()][$comment->getActorId()])) { |
|
| 98 | 98 | $actors[$comment->getActorType()][$comment->getActorId()] = 1; |
| 99 | 99 | } else { |
| 100 | 100 | $actors[$comment->getActorType()][$comment->getActorId()]++; |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | parent::__construct(); |
| 145 | 145 | $this->webRoot = $webRoot; |
| 146 | 146 | |
| 147 | - $this->registerService(\OCP\IServerContainer::class, function (IServerContainer $c) { |
|
| 147 | + $this->registerService(\OCP\IServerContainer::class, function(IServerContainer $c) { |
|
| 148 | 148 | return $c; |
| 149 | 149 | }); |
| 150 | 150 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | $this->registerAlias(IActionFactory::class, ActionFactory::class); |
| 155 | 155 | |
| 156 | 156 | |
| 157 | - $this->registerService(\OCP\IPreview::class, function (Server $c) { |
|
| 157 | + $this->registerService(\OCP\IPreview::class, function(Server $c) { |
|
| 158 | 158 | return new PreviewManager( |
| 159 | 159 | $c->getConfig(), |
| 160 | 160 | $c->getRootFolder(), |
@@ -165,13 +165,13 @@ discard block |
||
| 165 | 165 | }); |
| 166 | 166 | $this->registerAlias('PreviewManager', \OCP\IPreview::class); |
| 167 | 167 | |
| 168 | - $this->registerService(\OC\Preview\Watcher::class, function (Server $c) { |
|
| 168 | + $this->registerService(\OC\Preview\Watcher::class, function(Server $c) { |
|
| 169 | 169 | return new \OC\Preview\Watcher( |
| 170 | 170 | $c->getAppDataDir('preview') |
| 171 | 171 | ); |
| 172 | 172 | }); |
| 173 | 173 | |
| 174 | - $this->registerService('EncryptionManager', function (Server $c) { |
|
| 174 | + $this->registerService('EncryptionManager', function(Server $c) { |
|
| 175 | 175 | $view = new View(); |
| 176 | 176 | $util = new Encryption\Util( |
| 177 | 177 | $view, |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | ); |
| 190 | 190 | }); |
| 191 | 191 | |
| 192 | - $this->registerService('EncryptionFileHelper', function (Server $c) { |
|
| 192 | + $this->registerService('EncryptionFileHelper', function(Server $c) { |
|
| 193 | 193 | $util = new Encryption\Util( |
| 194 | 194 | new View(), |
| 195 | 195 | $c->getUserManager(), |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | ); |
| 204 | 204 | }); |
| 205 | 205 | |
| 206 | - $this->registerService('EncryptionKeyStorage', function (Server $c) { |
|
| 206 | + $this->registerService('EncryptionKeyStorage', function(Server $c) { |
|
| 207 | 207 | $view = new View(); |
| 208 | 208 | $util = new Encryption\Util( |
| 209 | 209 | $view, |
@@ -214,32 +214,32 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | return new Encryption\Keys\Storage($view, $util); |
| 216 | 216 | }); |
| 217 | - $this->registerService('TagMapper', function (Server $c) { |
|
| 217 | + $this->registerService('TagMapper', function(Server $c) { |
|
| 218 | 218 | return new TagMapper($c->getDatabaseConnection()); |
| 219 | 219 | }); |
| 220 | 220 | |
| 221 | - $this->registerService(\OCP\ITagManager::class, function (Server $c) { |
|
| 221 | + $this->registerService(\OCP\ITagManager::class, function(Server $c) { |
|
| 222 | 222 | $tagMapper = $c->query('TagMapper'); |
| 223 | 223 | return new TagManager($tagMapper, $c->getUserSession()); |
| 224 | 224 | }); |
| 225 | 225 | $this->registerAlias('TagManager', \OCP\ITagManager::class); |
| 226 | 226 | |
| 227 | - $this->registerService('SystemTagManagerFactory', function (Server $c) { |
|
| 227 | + $this->registerService('SystemTagManagerFactory', function(Server $c) { |
|
| 228 | 228 | $config = $c->getConfig(); |
| 229 | 229 | $factoryClass = $config->getSystemValue('systemtags.managerFactory', '\OC\SystemTag\ManagerFactory'); |
| 230 | 230 | /** @var \OC\SystemTag\ManagerFactory $factory */ |
| 231 | 231 | $factory = new $factoryClass($this); |
| 232 | 232 | return $factory; |
| 233 | 233 | }); |
| 234 | - $this->registerService(\OCP\SystemTag\ISystemTagManager::class, function (Server $c) { |
|
| 234 | + $this->registerService(\OCP\SystemTag\ISystemTagManager::class, function(Server $c) { |
|
| 235 | 235 | return $c->query('SystemTagManagerFactory')->getManager(); |
| 236 | 236 | }); |
| 237 | 237 | $this->registerAlias('SystemTagManager', \OCP\SystemTag\ISystemTagManager::class); |
| 238 | 238 | |
| 239 | - $this->registerService(\OCP\SystemTag\ISystemTagObjectMapper::class, function (Server $c) { |
|
| 239 | + $this->registerService(\OCP\SystemTag\ISystemTagObjectMapper::class, function(Server $c) { |
|
| 240 | 240 | return $c->query('SystemTagManagerFactory')->getObjectMapper(); |
| 241 | 241 | }); |
| 242 | - $this->registerService('RootFolder', function (Server $c) { |
|
| 242 | + $this->registerService('RootFolder', function(Server $c) { |
|
| 243 | 243 | $manager = \OC\Files\Filesystem::getMountManager(null); |
| 244 | 244 | $view = new View(); |
| 245 | 245 | $root = new Root( |
@@ -260,37 +260,37 @@ discard block |
||
| 260 | 260 | }); |
| 261 | 261 | $this->registerAlias('SystemTagObjectMapper', \OCP\SystemTag\ISystemTagObjectMapper::class); |
| 262 | 262 | |
| 263 | - $this->registerService(\OCP\Files\IRootFolder::class, function (Server $c) { |
|
| 264 | - return new LazyRoot(function () use ($c) { |
|
| 263 | + $this->registerService(\OCP\Files\IRootFolder::class, function(Server $c) { |
|
| 264 | + return new LazyRoot(function() use ($c) { |
|
| 265 | 265 | return $c->query('RootFolder'); |
| 266 | 266 | }); |
| 267 | 267 | }); |
| 268 | 268 | $this->registerAlias('LazyRootFolder', \OCP\Files\IRootFolder::class); |
| 269 | 269 | |
| 270 | - $this->registerService(\OCP\IUserManager::class, function (Server $c) { |
|
| 270 | + $this->registerService(\OCP\IUserManager::class, function(Server $c) { |
|
| 271 | 271 | $config = $c->getConfig(); |
| 272 | 272 | return new \OC\User\Manager($config); |
| 273 | 273 | }); |
| 274 | 274 | $this->registerAlias('UserManager', \OCP\IUserManager::class); |
| 275 | 275 | |
| 276 | - $this->registerService(\OCP\IGroupManager::class, function (Server $c) { |
|
| 276 | + $this->registerService(\OCP\IGroupManager::class, function(Server $c) { |
|
| 277 | 277 | $groupManager = new \OC\Group\Manager($this->getUserManager(), $this->getLogger()); |
| 278 | - $groupManager->listen('\OC\Group', 'preCreate', function ($gid) { |
|
| 278 | + $groupManager->listen('\OC\Group', 'preCreate', function($gid) { |
|
| 279 | 279 | \OC_Hook::emit('OC_Group', 'pre_createGroup', array('run' => true, 'gid' => $gid)); |
| 280 | 280 | }); |
| 281 | - $groupManager->listen('\OC\Group', 'postCreate', function (\OC\Group\Group $gid) { |
|
| 281 | + $groupManager->listen('\OC\Group', 'postCreate', function(\OC\Group\Group $gid) { |
|
| 282 | 282 | \OC_Hook::emit('OC_User', 'post_createGroup', array('gid' => $gid->getGID())); |
| 283 | 283 | }); |
| 284 | - $groupManager->listen('\OC\Group', 'preDelete', function (\OC\Group\Group $group) { |
|
| 284 | + $groupManager->listen('\OC\Group', 'preDelete', function(\OC\Group\Group $group) { |
|
| 285 | 285 | \OC_Hook::emit('OC_Group', 'pre_deleteGroup', array('run' => true, 'gid' => $group->getGID())); |
| 286 | 286 | }); |
| 287 | - $groupManager->listen('\OC\Group', 'postDelete', function (\OC\Group\Group $group) { |
|
| 287 | + $groupManager->listen('\OC\Group', 'postDelete', function(\OC\Group\Group $group) { |
|
| 288 | 288 | \OC_Hook::emit('OC_User', 'post_deleteGroup', array('gid' => $group->getGID())); |
| 289 | 289 | }); |
| 290 | - $groupManager->listen('\OC\Group', 'preAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
| 290 | + $groupManager->listen('\OC\Group', 'preAddUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
| 291 | 291 | \OC_Hook::emit('OC_Group', 'pre_addToGroup', array('run' => true, 'uid' => $user->getUID(), 'gid' => $group->getGID())); |
| 292 | 292 | }); |
| 293 | - $groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
| 293 | + $groupManager->listen('\OC\Group', 'postAddUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
| 294 | 294 | \OC_Hook::emit('OC_Group', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID())); |
| 295 | 295 | //Minimal fix to keep it backward compatible TODO: clean up all the GroupManager hooks |
| 296 | 296 | \OC_Hook::emit('OC_User', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID())); |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | }); |
| 300 | 300 | $this->registerAlias('GroupManager', \OCP\IGroupManager::class); |
| 301 | 301 | |
| 302 | - $this->registerService(Store::class, function (Server $c) { |
|
| 302 | + $this->registerService(Store::class, function(Server $c) { |
|
| 303 | 303 | $session = $c->getSession(); |
| 304 | 304 | if (\OC::$server->getSystemConfig()->getValue('installed', false)) { |
| 305 | 305 | $tokenProvider = $c->query('OC\Authentication\Token\IProvider'); |
@@ -310,11 +310,11 @@ discard block |
||
| 310 | 310 | return new Store($session, $logger, $tokenProvider); |
| 311 | 311 | }); |
| 312 | 312 | $this->registerAlias(IStore::class, Store::class); |
| 313 | - $this->registerService('OC\Authentication\Token\DefaultTokenMapper', function (Server $c) { |
|
| 313 | + $this->registerService('OC\Authentication\Token\DefaultTokenMapper', function(Server $c) { |
|
| 314 | 314 | $dbConnection = $c->getDatabaseConnection(); |
| 315 | 315 | return new Authentication\Token\DefaultTokenMapper($dbConnection); |
| 316 | 316 | }); |
| 317 | - $this->registerService('OC\Authentication\Token\DefaultTokenProvider', function (Server $c) { |
|
| 317 | + $this->registerService('OC\Authentication\Token\DefaultTokenProvider', function(Server $c) { |
|
| 318 | 318 | $mapper = $c->query('OC\Authentication\Token\DefaultTokenMapper'); |
| 319 | 319 | $crypto = $c->getCrypto(); |
| 320 | 320 | $config = $c->getConfig(); |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | }); |
| 325 | 325 | $this->registerAlias('OC\Authentication\Token\IProvider', 'OC\Authentication\Token\DefaultTokenProvider'); |
| 326 | 326 | |
| 327 | - $this->registerService(\OCP\IUserSession::class, function (Server $c) { |
|
| 327 | + $this->registerService(\OCP\IUserSession::class, function(Server $c) { |
|
| 328 | 328 | $manager = $c->getUserManager(); |
| 329 | 329 | $session = new \OC\Session\Memory(''); |
| 330 | 330 | $timeFactory = new TimeFactory(); |
@@ -337,44 +337,44 @@ discard block |
||
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | $userSession = new \OC\User\Session($manager, $session, $timeFactory, $defaultTokenProvider, $c->getConfig(), $c->getSecureRandom(), $c->getLockdownManager()); |
| 340 | - $userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) { |
|
| 340 | + $userSession->listen('\OC\User', 'preCreateUser', function($uid, $password) { |
|
| 341 | 341 | \OC_Hook::emit('OC_User', 'pre_createUser', array('run' => true, 'uid' => $uid, 'password' => $password)); |
| 342 | 342 | }); |
| 343 | - $userSession->listen('\OC\User', 'postCreateUser', function ($user, $password) { |
|
| 343 | + $userSession->listen('\OC\User', 'postCreateUser', function($user, $password) { |
|
| 344 | 344 | /** @var $user \OC\User\User */ |
| 345 | 345 | \OC_Hook::emit('OC_User', 'post_createUser', array('uid' => $user->getUID(), 'password' => $password)); |
| 346 | 346 | }); |
| 347 | - $userSession->listen('\OC\User', 'preDelete', function ($user) { |
|
| 347 | + $userSession->listen('\OC\User', 'preDelete', function($user) { |
|
| 348 | 348 | /** @var $user \OC\User\User */ |
| 349 | 349 | \OC_Hook::emit('OC_User', 'pre_deleteUser', array('run' => true, 'uid' => $user->getUID())); |
| 350 | 350 | }); |
| 351 | - $userSession->listen('\OC\User', 'postDelete', function ($user) { |
|
| 351 | + $userSession->listen('\OC\User', 'postDelete', function($user) { |
|
| 352 | 352 | /** @var $user \OC\User\User */ |
| 353 | 353 | \OC_Hook::emit('OC_User', 'post_deleteUser', array('uid' => $user->getUID())); |
| 354 | 354 | }); |
| 355 | - $userSession->listen('\OC\User', 'preSetPassword', function ($user, $password, $recoveryPassword) { |
|
| 355 | + $userSession->listen('\OC\User', 'preSetPassword', function($user, $password, $recoveryPassword) { |
|
| 356 | 356 | /** @var $user \OC\User\User */ |
| 357 | 357 | \OC_Hook::emit('OC_User', 'pre_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword)); |
| 358 | 358 | }); |
| 359 | - $userSession->listen('\OC\User', 'postSetPassword', function ($user, $password, $recoveryPassword) { |
|
| 359 | + $userSession->listen('\OC\User', 'postSetPassword', function($user, $password, $recoveryPassword) { |
|
| 360 | 360 | /** @var $user \OC\User\User */ |
| 361 | 361 | \OC_Hook::emit('OC_User', 'post_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword)); |
| 362 | 362 | }); |
| 363 | - $userSession->listen('\OC\User', 'preLogin', function ($uid, $password) { |
|
| 363 | + $userSession->listen('\OC\User', 'preLogin', function($uid, $password) { |
|
| 364 | 364 | \OC_Hook::emit('OC_User', 'pre_login', array('run' => true, 'uid' => $uid, 'password' => $password)); |
| 365 | 365 | }); |
| 366 | - $userSession->listen('\OC\User', 'postLogin', function ($user, $password) { |
|
| 366 | + $userSession->listen('\OC\User', 'postLogin', function($user, $password) { |
|
| 367 | 367 | /** @var $user \OC\User\User */ |
| 368 | 368 | \OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password)); |
| 369 | 369 | }); |
| 370 | - $userSession->listen('\OC\User', 'postRememberedLogin', function ($user, $password) { |
|
| 370 | + $userSession->listen('\OC\User', 'postRememberedLogin', function($user, $password) { |
|
| 371 | 371 | /** @var $user \OC\User\User */ |
| 372 | 372 | \OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password)); |
| 373 | 373 | }); |
| 374 | - $userSession->listen('\OC\User', 'logout', function () { |
|
| 374 | + $userSession->listen('\OC\User', 'logout', function() { |
|
| 375 | 375 | \OC_Hook::emit('OC_User', 'logout', array()); |
| 376 | 376 | }); |
| 377 | - $userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value, $oldValue) { |
|
| 377 | + $userSession->listen('\OC\User', 'changeUser', function($user, $feature, $value, $oldValue) { |
|
| 378 | 378 | /** @var $user \OC\User\User */ |
| 379 | 379 | \OC_Hook::emit('OC_User', 'changeUser', array('run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value, 'old_value' => $oldValue)); |
| 380 | 380 | }); |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | }); |
| 383 | 383 | $this->registerAlias('UserSession', \OCP\IUserSession::class); |
| 384 | 384 | |
| 385 | - $this->registerService(\OC\Authentication\TwoFactorAuth\Manager::class, function (Server $c) { |
|
| 385 | + $this->registerService(\OC\Authentication\TwoFactorAuth\Manager::class, function(Server $c) { |
|
| 386 | 386 | return new \OC\Authentication\TwoFactorAuth\Manager( |
| 387 | 387 | $c->getAppManager(), |
| 388 | 388 | $c->getSession(), |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | $this->registerAlias(\OCP\INavigationManager::class, \OC\NavigationManager::class); |
| 398 | 398 | $this->registerAlias('NavigationManager', \OCP\INavigationManager::class); |
| 399 | 399 | |
| 400 | - $this->registerService(\OC\AllConfig::class, function (Server $c) { |
|
| 400 | + $this->registerService(\OC\AllConfig::class, function(Server $c) { |
|
| 401 | 401 | return new \OC\AllConfig( |
| 402 | 402 | $c->getSystemConfig() |
| 403 | 403 | ); |
@@ -405,17 +405,17 @@ discard block |
||
| 405 | 405 | $this->registerAlias('AllConfig', \OC\AllConfig::class); |
| 406 | 406 | $this->registerAlias(\OCP\IConfig::class, \OC\AllConfig::class); |
| 407 | 407 | |
| 408 | - $this->registerService('SystemConfig', function ($c) use ($config) { |
|
| 408 | + $this->registerService('SystemConfig', function($c) use ($config) { |
|
| 409 | 409 | return new \OC\SystemConfig($config); |
| 410 | 410 | }); |
| 411 | 411 | |
| 412 | - $this->registerService(\OC\AppConfig::class, function (Server $c) { |
|
| 412 | + $this->registerService(\OC\AppConfig::class, function(Server $c) { |
|
| 413 | 413 | return new \OC\AppConfig($c->getDatabaseConnection()); |
| 414 | 414 | }); |
| 415 | 415 | $this->registerAlias('AppConfig', \OC\AppConfig::class); |
| 416 | 416 | $this->registerAlias(\OCP\IAppConfig::class, \OC\AppConfig::class); |
| 417 | 417 | |
| 418 | - $this->registerService(\OCP\L10N\IFactory::class, function (Server $c) { |
|
| 418 | + $this->registerService(\OCP\L10N\IFactory::class, function(Server $c) { |
|
| 419 | 419 | return new \OC\L10N\Factory( |
| 420 | 420 | $c->getConfig(), |
| 421 | 421 | $c->getRequest(), |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | }); |
| 426 | 426 | $this->registerAlias('L10NFactory', \OCP\L10N\IFactory::class); |
| 427 | 427 | |
| 428 | - $this->registerService(\OCP\IURLGenerator::class, function (Server $c) { |
|
| 428 | + $this->registerService(\OCP\IURLGenerator::class, function(Server $c) { |
|
| 429 | 429 | $config = $c->getConfig(); |
| 430 | 430 | $cacheFactory = $c->getMemCacheFactory(); |
| 431 | 431 | $request = $c->getRequest(); |
@@ -437,18 +437,18 @@ discard block |
||
| 437 | 437 | }); |
| 438 | 438 | $this->registerAlias('URLGenerator', \OCP\IURLGenerator::class); |
| 439 | 439 | |
| 440 | - $this->registerService('AppHelper', function ($c) { |
|
| 440 | + $this->registerService('AppHelper', function($c) { |
|
| 441 | 441 | return new \OC\AppHelper(); |
| 442 | 442 | }); |
| 443 | 443 | $this->registerAlias('AppFetcher', AppFetcher::class); |
| 444 | 444 | $this->registerAlias('CategoryFetcher', CategoryFetcher::class); |
| 445 | 445 | |
| 446 | - $this->registerService(\OCP\ICache::class, function ($c) { |
|
| 446 | + $this->registerService(\OCP\ICache::class, function($c) { |
|
| 447 | 447 | return new Cache\File(); |
| 448 | 448 | }); |
| 449 | 449 | $this->registerAlias('UserCache', \OCP\ICache::class); |
| 450 | 450 | |
| 451 | - $this->registerService(Factory::class, function (Server $c) { |
|
| 451 | + $this->registerService(Factory::class, function(Server $c) { |
|
| 452 | 452 | |
| 453 | 453 | $arrayCacheFactory = new \OC\Memcache\Factory('', $c->getLogger(), |
| 454 | 454 | '\\OC\\Memcache\\ArrayCache', |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | $version = implode(',', $v); |
| 466 | 466 | $instanceId = \OC_Util::getInstanceId(); |
| 467 | 467 | $path = \OC::$SERVERROOT; |
| 468 | - $prefix = md5($instanceId . '-' . $version . '-' . $path . '-' . $urlGenerator->getBaseUrl()); |
|
| 468 | + $prefix = md5($instanceId.'-'.$version.'-'.$path.'-'.$urlGenerator->getBaseUrl()); |
|
| 469 | 469 | return new \OC\Memcache\Factory($prefix, $c->getLogger(), |
| 470 | 470 | $config->getSystemValue('memcache.local', null), |
| 471 | 471 | $config->getSystemValue('memcache.distributed', null), |
@@ -478,12 +478,12 @@ discard block |
||
| 478 | 478 | $this->registerAlias('MemCacheFactory', Factory::class); |
| 479 | 479 | $this->registerAlias(ICacheFactory::class, Factory::class); |
| 480 | 480 | |
| 481 | - $this->registerService('RedisFactory', function (Server $c) { |
|
| 481 | + $this->registerService('RedisFactory', function(Server $c) { |
|
| 482 | 482 | $systemConfig = $c->getSystemConfig(); |
| 483 | 483 | return new RedisFactory($systemConfig); |
| 484 | 484 | }); |
| 485 | 485 | |
| 486 | - $this->registerService(\OCP\Activity\IManager::class, function (Server $c) { |
|
| 486 | + $this->registerService(\OCP\Activity\IManager::class, function(Server $c) { |
|
| 487 | 487 | return new \OC\Activity\Manager( |
| 488 | 488 | $c->getRequest(), |
| 489 | 489 | $c->getUserSession(), |
@@ -493,14 +493,14 @@ discard block |
||
| 493 | 493 | }); |
| 494 | 494 | $this->registerAlias('ActivityManager', \OCP\Activity\IManager::class); |
| 495 | 495 | |
| 496 | - $this->registerService(\OCP\Activity\IEventMerger::class, function (Server $c) { |
|
| 496 | + $this->registerService(\OCP\Activity\IEventMerger::class, function(Server $c) { |
|
| 497 | 497 | return new \OC\Activity\EventMerger( |
| 498 | 498 | $c->getL10N('lib') |
| 499 | 499 | ); |
| 500 | 500 | }); |
| 501 | 501 | $this->registerAlias(IValidator::class, Validator::class); |
| 502 | 502 | |
| 503 | - $this->registerService(\OCP\IAvatarManager::class, function (Server $c) { |
|
| 503 | + $this->registerService(\OCP\IAvatarManager::class, function(Server $c) { |
|
| 504 | 504 | return new AvatarManager( |
| 505 | 505 | $c->getUserManager(), |
| 506 | 506 | $c->getAppDataDir('avatar'), |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | }); |
| 512 | 512 | $this->registerAlias('AvatarManager', \OCP\IAvatarManager::class); |
| 513 | 513 | |
| 514 | - $this->registerService(\OCP\ILogger::class, function (Server $c) { |
|
| 514 | + $this->registerService(\OCP\ILogger::class, function(Server $c) { |
|
| 515 | 515 | $logType = $c->query('AllConfig')->getSystemValue('log_type', 'file'); |
| 516 | 516 | $logger = Log::getLogClass($logType); |
| 517 | 517 | call_user_func(array($logger, 'init')); |
@@ -520,7 +520,7 @@ discard block |
||
| 520 | 520 | }); |
| 521 | 521 | $this->registerAlias('Logger', \OCP\ILogger::class); |
| 522 | 522 | |
| 523 | - $this->registerService(\OCP\BackgroundJob\IJobList::class, function (Server $c) { |
|
| 523 | + $this->registerService(\OCP\BackgroundJob\IJobList::class, function(Server $c) { |
|
| 524 | 524 | $config = $c->getConfig(); |
| 525 | 525 | return new \OC\BackgroundJob\JobList( |
| 526 | 526 | $c->getDatabaseConnection(), |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | }); |
| 531 | 531 | $this->registerAlias('JobList', \OCP\BackgroundJob\IJobList::class); |
| 532 | 532 | |
| 533 | - $this->registerService(\OCP\Route\IRouter::class, function (Server $c) { |
|
| 533 | + $this->registerService(\OCP\Route\IRouter::class, function(Server $c) { |
|
| 534 | 534 | $cacheFactory = $c->getMemCacheFactory(); |
| 535 | 535 | $logger = $c->getLogger(); |
| 536 | 536 | if ($cacheFactory->isAvailableLowLatency()) { |
@@ -542,12 +542,12 @@ discard block |
||
| 542 | 542 | }); |
| 543 | 543 | $this->registerAlias('Router', \OCP\Route\IRouter::class); |
| 544 | 544 | |
| 545 | - $this->registerService(\OCP\ISearch::class, function ($c) { |
|
| 545 | + $this->registerService(\OCP\ISearch::class, function($c) { |
|
| 546 | 546 | return new Search(); |
| 547 | 547 | }); |
| 548 | 548 | $this->registerAlias('Search', \OCP\ISearch::class); |
| 549 | 549 | |
| 550 | - $this->registerService(\OC\Security\RateLimiting\Limiter::class, function ($c) { |
|
| 550 | + $this->registerService(\OC\Security\RateLimiting\Limiter::class, function($c) { |
|
| 551 | 551 | return new \OC\Security\RateLimiting\Limiter( |
| 552 | 552 | $this->getUserSession(), |
| 553 | 553 | $this->getRequest(), |
@@ -555,34 +555,34 @@ discard block |
||
| 555 | 555 | $c->query(\OC\Security\RateLimiting\Backend\IBackend::class) |
| 556 | 556 | ); |
| 557 | 557 | }); |
| 558 | - $this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function ($c) { |
|
| 558 | + $this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function($c) { |
|
| 559 | 559 | return new \OC\Security\RateLimiting\Backend\MemoryCache( |
| 560 | 560 | $this->getMemCacheFactory(), |
| 561 | 561 | new \OC\AppFramework\Utility\TimeFactory() |
| 562 | 562 | ); |
| 563 | 563 | }); |
| 564 | 564 | |
| 565 | - $this->registerService(\OCP\Security\ISecureRandom::class, function ($c) { |
|
| 565 | + $this->registerService(\OCP\Security\ISecureRandom::class, function($c) { |
|
| 566 | 566 | return new SecureRandom(); |
| 567 | 567 | }); |
| 568 | 568 | $this->registerAlias('SecureRandom', \OCP\Security\ISecureRandom::class); |
| 569 | 569 | |
| 570 | - $this->registerService(\OCP\Security\ICrypto::class, function (Server $c) { |
|
| 570 | + $this->registerService(\OCP\Security\ICrypto::class, function(Server $c) { |
|
| 571 | 571 | return new Crypto($c->getConfig(), $c->getSecureRandom()); |
| 572 | 572 | }); |
| 573 | 573 | $this->registerAlias('Crypto', \OCP\Security\ICrypto::class); |
| 574 | 574 | |
| 575 | - $this->registerService(\OCP\Security\IHasher::class, function (Server $c) { |
|
| 575 | + $this->registerService(\OCP\Security\IHasher::class, function(Server $c) { |
|
| 576 | 576 | return new Hasher($c->getConfig()); |
| 577 | 577 | }); |
| 578 | 578 | $this->registerAlias('Hasher', \OCP\Security\IHasher::class); |
| 579 | 579 | |
| 580 | - $this->registerService(\OCP\Security\ICredentialsManager::class, function (Server $c) { |
|
| 580 | + $this->registerService(\OCP\Security\ICredentialsManager::class, function(Server $c) { |
|
| 581 | 581 | return new CredentialsManager($c->getCrypto(), $c->getDatabaseConnection()); |
| 582 | 582 | }); |
| 583 | 583 | $this->registerAlias('CredentialsManager', \OCP\Security\ICredentialsManager::class); |
| 584 | 584 | |
| 585 | - $this->registerService(IDBConnection::class, function (Server $c) { |
|
| 585 | + $this->registerService(IDBConnection::class, function(Server $c) { |
|
| 586 | 586 | $systemConfig = $c->getSystemConfig(); |
| 587 | 587 | $factory = new \OC\DB\ConnectionFactory($systemConfig); |
| 588 | 588 | $type = $systemConfig->getValue('dbtype', 'sqlite'); |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | }); |
| 597 | 597 | $this->registerAlias('DatabaseConnection', IDBConnection::class); |
| 598 | 598 | |
| 599 | - $this->registerService('HTTPHelper', function (Server $c) { |
|
| 599 | + $this->registerService('HTTPHelper', function(Server $c) { |
|
| 600 | 600 | $config = $c->getConfig(); |
| 601 | 601 | return new HTTPHelper( |
| 602 | 602 | $config, |
@@ -604,7 +604,7 @@ discard block |
||
| 604 | 604 | ); |
| 605 | 605 | }); |
| 606 | 606 | |
| 607 | - $this->registerService(\OCP\Http\Client\IClientService::class, function (Server $c) { |
|
| 607 | + $this->registerService(\OCP\Http\Client\IClientService::class, function(Server $c) { |
|
| 608 | 608 | $user = \OC_User::getUser(); |
| 609 | 609 | $uid = $user ? $user : null; |
| 610 | 610 | return new ClientService( |
@@ -619,7 +619,7 @@ discard block |
||
| 619 | 619 | ); |
| 620 | 620 | }); |
| 621 | 621 | $this->registerAlias('HttpClientService', \OCP\Http\Client\IClientService::class); |
| 622 | - $this->registerService(\OCP\Diagnostics\IEventLogger::class, function (Server $c) { |
|
| 622 | + $this->registerService(\OCP\Diagnostics\IEventLogger::class, function(Server $c) { |
|
| 623 | 623 | $eventLogger = new EventLogger(); |
| 624 | 624 | if ($c->getSystemConfig()->getValue('debug', false)) { |
| 625 | 625 | // In debug mode, module is being activated by default |
@@ -629,7 +629,7 @@ discard block |
||
| 629 | 629 | }); |
| 630 | 630 | $this->registerAlias('EventLogger', \OCP\Diagnostics\IEventLogger::class); |
| 631 | 631 | |
| 632 | - $this->registerService(\OCP\Diagnostics\IQueryLogger::class, function (Server $c) { |
|
| 632 | + $this->registerService(\OCP\Diagnostics\IQueryLogger::class, function(Server $c) { |
|
| 633 | 633 | $queryLogger = new QueryLogger(); |
| 634 | 634 | if ($c->getSystemConfig()->getValue('debug', false)) { |
| 635 | 635 | // In debug mode, module is being activated by default |
@@ -639,7 +639,7 @@ discard block |
||
| 639 | 639 | }); |
| 640 | 640 | $this->registerAlias('QueryLogger', \OCP\Diagnostics\IQueryLogger::class); |
| 641 | 641 | |
| 642 | - $this->registerService(TempManager::class, function (Server $c) { |
|
| 642 | + $this->registerService(TempManager::class, function(Server $c) { |
|
| 643 | 643 | return new TempManager( |
| 644 | 644 | $c->getLogger(), |
| 645 | 645 | $c->getConfig() |
@@ -648,7 +648,7 @@ discard block |
||
| 648 | 648 | $this->registerAlias('TempManager', TempManager::class); |
| 649 | 649 | $this->registerAlias(ITempManager::class, TempManager::class); |
| 650 | 650 | |
| 651 | - $this->registerService(AppManager::class, function (Server $c) { |
|
| 651 | + $this->registerService(AppManager::class, function(Server $c) { |
|
| 652 | 652 | return new \OC\App\AppManager( |
| 653 | 653 | $c->getUserSession(), |
| 654 | 654 | $c->getAppConfig(), |
@@ -660,7 +660,7 @@ discard block |
||
| 660 | 660 | $this->registerAlias('AppManager', AppManager::class); |
| 661 | 661 | $this->registerAlias(IAppManager::class, AppManager::class); |
| 662 | 662 | |
| 663 | - $this->registerService(\OCP\IDateTimeZone::class, function (Server $c) { |
|
| 663 | + $this->registerService(\OCP\IDateTimeZone::class, function(Server $c) { |
|
| 664 | 664 | return new DateTimeZone( |
| 665 | 665 | $c->getConfig(), |
| 666 | 666 | $c->getSession() |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | }); |
| 669 | 669 | $this->registerAlias('DateTimeZone', \OCP\IDateTimeZone::class); |
| 670 | 670 | |
| 671 | - $this->registerService(\OCP\IDateTimeFormatter::class, function (Server $c) { |
|
| 671 | + $this->registerService(\OCP\IDateTimeFormatter::class, function(Server $c) { |
|
| 672 | 672 | $language = $c->getConfig()->getUserValue($c->getSession()->get('user_id'), 'core', 'lang', null); |
| 673 | 673 | |
| 674 | 674 | return new DateTimeFormatter( |
@@ -678,7 +678,7 @@ discard block |
||
| 678 | 678 | }); |
| 679 | 679 | $this->registerAlias('DateTimeFormatter', \OCP\IDateTimeFormatter::class); |
| 680 | 680 | |
| 681 | - $this->registerService(\OCP\Files\Config\IUserMountCache::class, function (Server $c) { |
|
| 681 | + $this->registerService(\OCP\Files\Config\IUserMountCache::class, function(Server $c) { |
|
| 682 | 682 | $mountCache = new UserMountCache($c->getDatabaseConnection(), $c->getUserManager(), $c->getLogger()); |
| 683 | 683 | $listener = new UserMountCacheListener($mountCache); |
| 684 | 684 | $listener->listen($c->getUserManager()); |
@@ -686,7 +686,7 @@ discard block |
||
| 686 | 686 | }); |
| 687 | 687 | $this->registerAlias('UserMountCache', \OCP\Files\Config\IUserMountCache::class); |
| 688 | 688 | |
| 689 | - $this->registerService(\OCP\Files\Config\IMountProviderCollection::class, function (Server $c) { |
|
| 689 | + $this->registerService(\OCP\Files\Config\IMountProviderCollection::class, function(Server $c) { |
|
| 690 | 690 | $loader = \OC\Files\Filesystem::getLoader(); |
| 691 | 691 | $mountCache = $c->query('UserMountCache'); |
| 692 | 692 | $manager = new \OC\Files\Config\MountProviderCollection($loader, $mountCache); |
@@ -702,10 +702,10 @@ discard block |
||
| 702 | 702 | }); |
| 703 | 703 | $this->registerAlias('MountConfigManager', \OCP\Files\Config\IMountProviderCollection::class); |
| 704 | 704 | |
| 705 | - $this->registerService('IniWrapper', function ($c) { |
|
| 705 | + $this->registerService('IniWrapper', function($c) { |
|
| 706 | 706 | return new IniGetWrapper(); |
| 707 | 707 | }); |
| 708 | - $this->registerService('AsyncCommandBus', function (Server $c) { |
|
| 708 | + $this->registerService('AsyncCommandBus', function(Server $c) { |
|
| 709 | 709 | $busClass = $c->getConfig()->getSystemValue('commandbus'); |
| 710 | 710 | if ($busClass) { |
| 711 | 711 | list($app, $class) = explode('::', $busClass, 2); |
@@ -720,10 +720,10 @@ discard block |
||
| 720 | 720 | return new CronBus($jobList); |
| 721 | 721 | } |
| 722 | 722 | }); |
| 723 | - $this->registerService('TrustedDomainHelper', function ($c) { |
|
| 723 | + $this->registerService('TrustedDomainHelper', function($c) { |
|
| 724 | 724 | return new TrustedDomainHelper($this->getConfig()); |
| 725 | 725 | }); |
| 726 | - $this->registerService('Throttler', function (Server $c) { |
|
| 726 | + $this->registerService('Throttler', function(Server $c) { |
|
| 727 | 727 | return new Throttler( |
| 728 | 728 | $c->getDatabaseConnection(), |
| 729 | 729 | new TimeFactory(), |
@@ -731,7 +731,7 @@ discard block |
||
| 731 | 731 | $c->getConfig() |
| 732 | 732 | ); |
| 733 | 733 | }); |
| 734 | - $this->registerService('IntegrityCodeChecker', function (Server $c) { |
|
| 734 | + $this->registerService('IntegrityCodeChecker', function(Server $c) { |
|
| 735 | 735 | // IConfig and IAppManager requires a working database. This code |
| 736 | 736 | // might however be called when ownCloud is not yet setup. |
| 737 | 737 | if (\OC::$server->getSystemConfig()->getValue('installed', false)) { |
@@ -752,7 +752,7 @@ discard block |
||
| 752 | 752 | $c->getTempManager() |
| 753 | 753 | ); |
| 754 | 754 | }); |
| 755 | - $this->registerService(\OCP\IRequest::class, function ($c) { |
|
| 755 | + $this->registerService(\OCP\IRequest::class, function($c) { |
|
| 756 | 756 | if (isset($this['urlParams'])) { |
| 757 | 757 | $urlParams = $this['urlParams']; |
| 758 | 758 | } else { |
@@ -788,7 +788,7 @@ discard block |
||
| 788 | 788 | }); |
| 789 | 789 | $this->registerAlias('Request', \OCP\IRequest::class); |
| 790 | 790 | |
| 791 | - $this->registerService(\OCP\Mail\IMailer::class, function (Server $c) { |
|
| 791 | + $this->registerService(\OCP\Mail\IMailer::class, function(Server $c) { |
|
| 792 | 792 | return new Mailer( |
| 793 | 793 | $c->getConfig(), |
| 794 | 794 | $c->getLogger(), |
@@ -799,7 +799,7 @@ discard block |
||
| 799 | 799 | }); |
| 800 | 800 | $this->registerAlias('Mailer', \OCP\Mail\IMailer::class); |
| 801 | 801 | |
| 802 | - $this->registerService('LDAPProvider', function (Server $c) { |
|
| 802 | + $this->registerService('LDAPProvider', function(Server $c) { |
|
| 803 | 803 | $config = $c->getConfig(); |
| 804 | 804 | $factoryClass = $config->getSystemValue('ldapProviderFactory', null); |
| 805 | 805 | if (is_null($factoryClass)) { |
@@ -809,7 +809,7 @@ discard block |
||
| 809 | 809 | $factory = new $factoryClass($this); |
| 810 | 810 | return $factory->getLDAPProvider(); |
| 811 | 811 | }); |
| 812 | - $this->registerService(ILockingProvider::class, function (Server $c) { |
|
| 812 | + $this->registerService(ILockingProvider::class, function(Server $c) { |
|
| 813 | 813 | $ini = $c->getIniWrapper(); |
| 814 | 814 | $config = $c->getConfig(); |
| 815 | 815 | $ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time'))); |
@@ -826,49 +826,49 @@ discard block |
||
| 826 | 826 | }); |
| 827 | 827 | $this->registerAlias('LockingProvider', ILockingProvider::class); |
| 828 | 828 | |
| 829 | - $this->registerService(\OCP\Files\Mount\IMountManager::class, function () { |
|
| 829 | + $this->registerService(\OCP\Files\Mount\IMountManager::class, function() { |
|
| 830 | 830 | return new \OC\Files\Mount\Manager(); |
| 831 | 831 | }); |
| 832 | 832 | $this->registerAlias('MountManager', \OCP\Files\Mount\IMountManager::class); |
| 833 | 833 | |
| 834 | - $this->registerService(\OCP\Files\IMimeTypeDetector::class, function (Server $c) { |
|
| 834 | + $this->registerService(\OCP\Files\IMimeTypeDetector::class, function(Server $c) { |
|
| 835 | 835 | return new \OC\Files\Type\Detection( |
| 836 | 836 | $c->getURLGenerator(), |
| 837 | 837 | \OC::$configDir, |
| 838 | - \OC::$SERVERROOT . '/resources/config/' |
|
| 838 | + \OC::$SERVERROOT.'/resources/config/' |
|
| 839 | 839 | ); |
| 840 | 840 | }); |
| 841 | 841 | $this->registerAlias('MimeTypeDetector', \OCP\Files\IMimeTypeDetector::class); |
| 842 | 842 | |
| 843 | - $this->registerService(\OCP\Files\IMimeTypeLoader::class, function (Server $c) { |
|
| 843 | + $this->registerService(\OCP\Files\IMimeTypeLoader::class, function(Server $c) { |
|
| 844 | 844 | return new \OC\Files\Type\Loader( |
| 845 | 845 | $c->getDatabaseConnection() |
| 846 | 846 | ); |
| 847 | 847 | }); |
| 848 | 848 | $this->registerAlias('MimeTypeLoader', \OCP\Files\IMimeTypeLoader::class); |
| 849 | - $this->registerService(BundleFetcher::class, function () { |
|
| 849 | + $this->registerService(BundleFetcher::class, function() { |
|
| 850 | 850 | return new BundleFetcher($this->getL10N('lib')); |
| 851 | 851 | }); |
| 852 | - $this->registerService(\OCP\Notification\IManager::class, function (Server $c) { |
|
| 852 | + $this->registerService(\OCP\Notification\IManager::class, function(Server $c) { |
|
| 853 | 853 | return new Manager( |
| 854 | 854 | $c->query(IValidator::class) |
| 855 | 855 | ); |
| 856 | 856 | }); |
| 857 | 857 | $this->registerAlias('NotificationManager', \OCP\Notification\IManager::class); |
| 858 | 858 | |
| 859 | - $this->registerService(\OC\CapabilitiesManager::class, function (Server $c) { |
|
| 859 | + $this->registerService(\OC\CapabilitiesManager::class, function(Server $c) { |
|
| 860 | 860 | $manager = new \OC\CapabilitiesManager($c->getLogger()); |
| 861 | - $manager->registerCapability(function () use ($c) { |
|
| 861 | + $manager->registerCapability(function() use ($c) { |
|
| 862 | 862 | return new \OC\OCS\CoreCapabilities($c->getConfig()); |
| 863 | 863 | }); |
| 864 | - $manager->registerCapability(function () use ($c) { |
|
| 864 | + $manager->registerCapability(function() use ($c) { |
|
| 865 | 865 | return $c->query(\OC\Security\Bruteforce\Capabilities::class); |
| 866 | 866 | }); |
| 867 | 867 | return $manager; |
| 868 | 868 | }); |
| 869 | 869 | $this->registerAlias('CapabilitiesManager', \OC\CapabilitiesManager::class); |
| 870 | 870 | |
| 871 | - $this->registerService(\OCP\Comments\ICommentsManager::class, function (Server $c) { |
|
| 871 | + $this->registerService(\OCP\Comments\ICommentsManager::class, function(Server $c) { |
|
| 872 | 872 | $config = $c->getConfig(); |
| 873 | 873 | $factoryClass = $config->getSystemValue('comments.managerFactory', '\OC\Comments\ManagerFactory'); |
| 874 | 874 | /** @var \OCP\Comments\ICommentsManagerFactory $factory */ |
@@ -877,7 +877,7 @@ discard block |
||
| 877 | 877 | }); |
| 878 | 878 | $this->registerAlias('CommentsManager', \OCP\Comments\ICommentsManager::class); |
| 879 | 879 | |
| 880 | - $this->registerService('ThemingDefaults', function (Server $c) { |
|
| 880 | + $this->registerService('ThemingDefaults', function(Server $c) { |
|
| 881 | 881 | /* |
| 882 | 882 | * Dark magic for autoloader. |
| 883 | 883 | * If we do a class_exists it will try to load the class which will |
@@ -904,7 +904,7 @@ discard block |
||
| 904 | 904 | } |
| 905 | 905 | return new \OC_Defaults(); |
| 906 | 906 | }); |
| 907 | - $this->registerService(SCSSCacher::class, function (Server $c) { |
|
| 907 | + $this->registerService(SCSSCacher::class, function(Server $c) { |
|
| 908 | 908 | /** @var Factory $cacheFactory */ |
| 909 | 909 | $cacheFactory = $c->query(Factory::class); |
| 910 | 910 | return new SCSSCacher( |
@@ -917,13 +917,13 @@ discard block |
||
| 917 | 917 | $cacheFactory->create('SCSS') |
| 918 | 918 | ); |
| 919 | 919 | }); |
| 920 | - $this->registerService(EventDispatcher::class, function () { |
|
| 920 | + $this->registerService(EventDispatcher::class, function() { |
|
| 921 | 921 | return new EventDispatcher(); |
| 922 | 922 | }); |
| 923 | 923 | $this->registerAlias('EventDispatcher', EventDispatcher::class); |
| 924 | 924 | $this->registerAlias(EventDispatcherInterface::class, EventDispatcher::class); |
| 925 | 925 | |
| 926 | - $this->registerService('CryptoWrapper', function (Server $c) { |
|
| 926 | + $this->registerService('CryptoWrapper', function(Server $c) { |
|
| 927 | 927 | // FIXME: Instantiiated here due to cyclic dependency |
| 928 | 928 | $request = new Request( |
| 929 | 929 | [ |
@@ -948,7 +948,7 @@ discard block |
||
| 948 | 948 | $request |
| 949 | 949 | ); |
| 950 | 950 | }); |
| 951 | - $this->registerService('CsrfTokenManager', function (Server $c) { |
|
| 951 | + $this->registerService('CsrfTokenManager', function(Server $c) { |
|
| 952 | 952 | $tokenGenerator = new CsrfTokenGenerator($c->getSecureRandom()); |
| 953 | 953 | |
| 954 | 954 | return new CsrfTokenManager( |
@@ -956,22 +956,22 @@ discard block |
||
| 956 | 956 | $c->query(SessionStorage::class) |
| 957 | 957 | ); |
| 958 | 958 | }); |
| 959 | - $this->registerService(SessionStorage::class, function (Server $c) { |
|
| 959 | + $this->registerService(SessionStorage::class, function(Server $c) { |
|
| 960 | 960 | return new SessionStorage($c->getSession()); |
| 961 | 961 | }); |
| 962 | - $this->registerService(\OCP\Security\IContentSecurityPolicyManager::class, function (Server $c) { |
|
| 962 | + $this->registerService(\OCP\Security\IContentSecurityPolicyManager::class, function(Server $c) { |
|
| 963 | 963 | return new ContentSecurityPolicyManager(); |
| 964 | 964 | }); |
| 965 | 965 | $this->registerAlias('ContentSecurityPolicyManager', \OCP\Security\IContentSecurityPolicyManager::class); |
| 966 | 966 | |
| 967 | - $this->registerService('ContentSecurityPolicyNonceManager', function (Server $c) { |
|
| 967 | + $this->registerService('ContentSecurityPolicyNonceManager', function(Server $c) { |
|
| 968 | 968 | return new ContentSecurityPolicyNonceManager( |
| 969 | 969 | $c->getCsrfTokenManager(), |
| 970 | 970 | $c->getRequest() |
| 971 | 971 | ); |
| 972 | 972 | }); |
| 973 | 973 | |
| 974 | - $this->registerService(\OCP\Share\IManager::class, function (Server $c) { |
|
| 974 | + $this->registerService(\OCP\Share\IManager::class, function(Server $c) { |
|
| 975 | 975 | $config = $c->getConfig(); |
| 976 | 976 | $factoryClass = $config->getSystemValue('sharing.managerFactory', '\OC\Share20\ProviderFactory'); |
| 977 | 977 | /** @var \OCP\Share\IProviderFactory $factory */ |
@@ -1014,7 +1014,7 @@ discard block |
||
| 1014 | 1014 | |
| 1015 | 1015 | $this->registerAlias(\OCP\Collaboration\AutoComplete\IManager::class, \OC\Collaboration\AutoComplete\Manager::class); |
| 1016 | 1016 | |
| 1017 | - $this->registerService('SettingsManager', function (Server $c) { |
|
| 1017 | + $this->registerService('SettingsManager', function(Server $c) { |
|
| 1018 | 1018 | $manager = new \OC\Settings\Manager( |
| 1019 | 1019 | $c->getLogger(), |
| 1020 | 1020 | $c->getDatabaseConnection(), |
@@ -1034,29 +1034,29 @@ discard block |
||
| 1034 | 1034 | ); |
| 1035 | 1035 | return $manager; |
| 1036 | 1036 | }); |
| 1037 | - $this->registerService(\OC\Files\AppData\Factory::class, function (Server $c) { |
|
| 1037 | + $this->registerService(\OC\Files\AppData\Factory::class, function(Server $c) { |
|
| 1038 | 1038 | return new \OC\Files\AppData\Factory( |
| 1039 | 1039 | $c->getRootFolder(), |
| 1040 | 1040 | $c->getSystemConfig() |
| 1041 | 1041 | ); |
| 1042 | 1042 | }); |
| 1043 | 1043 | |
| 1044 | - $this->registerService('LockdownManager', function (Server $c) { |
|
| 1045 | - return new LockdownManager(function () use ($c) { |
|
| 1044 | + $this->registerService('LockdownManager', function(Server $c) { |
|
| 1045 | + return new LockdownManager(function() use ($c) { |
|
| 1046 | 1046 | return $c->getSession(); |
| 1047 | 1047 | }); |
| 1048 | 1048 | }); |
| 1049 | 1049 | |
| 1050 | - $this->registerService(\OCP\OCS\IDiscoveryService::class, function (Server $c) { |
|
| 1050 | + $this->registerService(\OCP\OCS\IDiscoveryService::class, function(Server $c) { |
|
| 1051 | 1051 | return new DiscoveryService($c->getMemCacheFactory(), $c->getHTTPClientService()); |
| 1052 | 1052 | }); |
| 1053 | 1053 | |
| 1054 | - $this->registerService(ICloudIdManager::class, function (Server $c) { |
|
| 1054 | + $this->registerService(ICloudIdManager::class, function(Server $c) { |
|
| 1055 | 1055 | return new CloudIdManager(); |
| 1056 | 1056 | }); |
| 1057 | 1057 | |
| 1058 | 1058 | /* To trick DI since we don't extend the DIContainer here */ |
| 1059 | - $this->registerService(CleanPreviewsBackgroundJob::class, function (Server $c) { |
|
| 1059 | + $this->registerService(CleanPreviewsBackgroundJob::class, function(Server $c) { |
|
| 1060 | 1060 | return new CleanPreviewsBackgroundJob( |
| 1061 | 1061 | $c->getRootFolder(), |
| 1062 | 1062 | $c->getLogger(), |
@@ -1071,18 +1071,18 @@ discard block |
||
| 1071 | 1071 | $this->registerAlias(\OCP\AppFramework\Utility\ITimeFactory::class, \OC\AppFramework\Utility\TimeFactory::class); |
| 1072 | 1072 | $this->registerAlias('TimeFactory', \OCP\AppFramework\Utility\ITimeFactory::class); |
| 1073 | 1073 | |
| 1074 | - $this->registerService(Defaults::class, function (Server $c) { |
|
| 1074 | + $this->registerService(Defaults::class, function(Server $c) { |
|
| 1075 | 1075 | return new Defaults( |
| 1076 | 1076 | $c->getThemingDefaults() |
| 1077 | 1077 | ); |
| 1078 | 1078 | }); |
| 1079 | 1079 | $this->registerAlias('Defaults', \OCP\Defaults::class); |
| 1080 | 1080 | |
| 1081 | - $this->registerService(\OCP\ISession::class, function (SimpleContainer $c) { |
|
| 1081 | + $this->registerService(\OCP\ISession::class, function(SimpleContainer $c) { |
|
| 1082 | 1082 | return $c->query(\OCP\IUserSession::class)->getSession(); |
| 1083 | 1083 | }); |
| 1084 | 1084 | |
| 1085 | - $this->registerService(IShareHelper::class, function (Server $c) { |
|
| 1085 | + $this->registerService(IShareHelper::class, function(Server $c) { |
|
| 1086 | 1086 | return new ShareHelper( |
| 1087 | 1087 | $c->query(\OCP\Share\IManager::class) |
| 1088 | 1088 | ); |
@@ -1223,7 +1223,7 @@ discard block |
||
| 1223 | 1223 | * @deprecated since 9.2.0 use IAppData |
| 1224 | 1224 | */ |
| 1225 | 1225 | public function getAppFolder() { |
| 1226 | - $dir = '/' . \OC_App::getCurrentApp(); |
|
| 1226 | + $dir = '/'.\OC_App::getCurrentApp(); |
|
| 1227 | 1227 | $root = $this->getRootFolder(); |
| 1228 | 1228 | if (!$root->nodeExists($dir)) { |
| 1229 | 1229 | $folder = $root->newFolder($dir); |
@@ -1807,7 +1807,7 @@ discard block |
||
| 1807 | 1807 | /** |
| 1808 | 1808 | * @return \OCP\Collaboration\AutoComplete\IManager |
| 1809 | 1809 | */ |
| 1810 | - public function getAutoCompleteManager(){ |
|
| 1810 | + public function getAutoCompleteManager() { |
|
| 1811 | 1811 | return $this->query(IManager::class); |
| 1812 | 1812 | } |
| 1813 | 1813 | |
@@ -6,74 +6,74 @@ |
||
| 6 | 6 | |
| 7 | 7 | class ComposerStaticInitFiles_Sharing |
| 8 | 8 | { |
| 9 | - public static $prefixLengthsPsr4 = array ( |
|
| 9 | + public static $prefixLengthsPsr4 = array( |
|
| 10 | 10 | 'O' => |
| 11 | - array ( |
|
| 11 | + array( |
|
| 12 | 12 | 'OCA\\Files_Sharing\\' => 18, |
| 13 | 13 | ), |
| 14 | 14 | ); |
| 15 | 15 | |
| 16 | - public static $prefixDirsPsr4 = array ( |
|
| 16 | + public static $prefixDirsPsr4 = array( |
|
| 17 | 17 | 'OCA\\Files_Sharing\\' => |
| 18 | - array ( |
|
| 19 | - 0 => __DIR__ . '/..' . '/../lib', |
|
| 18 | + array( |
|
| 19 | + 0 => __DIR__.'/..'.'/../lib', |
|
| 20 | 20 | ), |
| 21 | 21 | ); |
| 22 | 22 | |
| 23 | - public static $classMap = array ( |
|
| 24 | - 'OCA\\Files_Sharing\\Activity\\Filter' => __DIR__ . '/..' . '/../lib/Activity/Filter.php', |
|
| 25 | - 'OCA\\Files_Sharing\\Activity\\Providers\\Base' => __DIR__ . '/..' . '/../lib/Activity/Providers/Base.php', |
|
| 26 | - 'OCA\\Files_Sharing\\Activity\\Providers\\Downloads' => __DIR__ . '/..' . '/../lib/Activity/Providers/Downloads.php', |
|
| 27 | - 'OCA\\Files_Sharing\\Activity\\Providers\\Groups' => __DIR__ . '/..' . '/../lib/Activity/Providers/Groups.php', |
|
| 28 | - 'OCA\\Files_Sharing\\Activity\\Providers\\PublicLinks' => __DIR__ . '/..' . '/../lib/Activity/Providers/PublicLinks.php', |
|
| 29 | - 'OCA\\Files_Sharing\\Activity\\Providers\\RemoteShares' => __DIR__ . '/..' . '/../lib/Activity/Providers/RemoteShares.php', |
|
| 30 | - 'OCA\\Files_Sharing\\Activity\\Providers\\Users' => __DIR__ . '/..' . '/../lib/Activity/Providers/Users.php', |
|
| 31 | - 'OCA\\Files_Sharing\\Activity\\Settings\\PublicLinks' => __DIR__ . '/..' . '/../lib/Activity/Settings/PublicLinks.php', |
|
| 32 | - 'OCA\\Files_Sharing\\Activity\\Settings\\RemoteShare' => __DIR__ . '/..' . '/../lib/Activity/Settings/RemoteShare.php', |
|
| 33 | - 'OCA\\Files_Sharing\\Activity\\Settings\\Shared' => __DIR__ . '/..' . '/../lib/Activity/Settings/Shared.php', |
|
| 34 | - 'OCA\\Files_Sharing\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php', |
|
| 35 | - 'OCA\\Files_Sharing\\Cache' => __DIR__ . '/..' . '/../lib/Cache.php', |
|
| 36 | - 'OCA\\Files_Sharing\\Capabilities' => __DIR__ . '/..' . '/../lib/Capabilities.php', |
|
| 37 | - 'OCA\\Files_Sharing\\Collaboration\\ShareRecipientSorter' => __DIR__ . '/..' . '/../lib/Collaboration/ShareRecipientSorter.php', |
|
| 38 | - 'OCA\\Files_Sharing\\Command\\CleanupRemoteStorages' => __DIR__ . '/..' . '/../lib/Command/CleanupRemoteStorages.php', |
|
| 39 | - 'OCA\\Files_Sharing\\Controller\\ExternalSharesController' => __DIR__ . '/..' . '/../lib/Controller/ExternalSharesController.php', |
|
| 40 | - 'OCA\\Files_Sharing\\Controller\\PublicPreviewController' => __DIR__ . '/..' . '/../lib/Controller/PublicPreviewController.php', |
|
| 41 | - 'OCA\\Files_Sharing\\Controller\\RemoteController' => __DIR__ . '/..' . '/../lib/Controller/RemoteController.php', |
|
| 42 | - 'OCA\\Files_Sharing\\Controller\\ShareAPIController' => __DIR__ . '/..' . '/../lib/Controller/ShareAPIController.php', |
|
| 43 | - 'OCA\\Files_Sharing\\Controller\\ShareController' => __DIR__ . '/..' . '/../lib/Controller/ShareController.php', |
|
| 44 | - 'OCA\\Files_Sharing\\Controller\\ShareInfoController' => __DIR__ . '/..' . '/../lib/Controller/ShareInfoController.php', |
|
| 45 | - 'OCA\\Files_Sharing\\Controller\\ShareesAPIController' => __DIR__ . '/..' . '/../lib/Controller/ShareesAPIController.php', |
|
| 46 | - 'OCA\\Files_Sharing\\DeleteOrphanedSharesJob' => __DIR__ . '/..' . '/../lib/DeleteOrphanedSharesJob.php', |
|
| 47 | - 'OCA\\Files_Sharing\\Exceptions\\BrokenPath' => __DIR__ . '/..' . '/../lib/Exceptions/BrokenPath.php', |
|
| 48 | - 'OCA\\Files_Sharing\\Exceptions\\S2SException' => __DIR__ . '/..' . '/../lib/Exceptions/S2SException.php', |
|
| 49 | - 'OCA\\Files_Sharing\\ExpireSharesJob' => __DIR__ . '/..' . '/../lib/ExpireSharesJob.php', |
|
| 50 | - 'OCA\\Files_Sharing\\External\\Cache' => __DIR__ . '/..' . '/../lib/External/Cache.php', |
|
| 51 | - 'OCA\\Files_Sharing\\External\\Manager' => __DIR__ . '/..' . '/../lib/External/Manager.php', |
|
| 52 | - 'OCA\\Files_Sharing\\External\\Mount' => __DIR__ . '/..' . '/../lib/External/Mount.php', |
|
| 53 | - 'OCA\\Files_Sharing\\External\\MountProvider' => __DIR__ . '/..' . '/../lib/External/MountProvider.php', |
|
| 54 | - 'OCA\\Files_Sharing\\External\\Scanner' => __DIR__ . '/..' . '/../lib/External/Scanner.php', |
|
| 55 | - 'OCA\\Files_Sharing\\External\\Storage' => __DIR__ . '/..' . '/../lib/External/Storage.php', |
|
| 56 | - 'OCA\\Files_Sharing\\External\\Watcher' => __DIR__ . '/..' . '/../lib/External/Watcher.php', |
|
| 57 | - 'OCA\\Files_Sharing\\Helper' => __DIR__ . '/..' . '/../lib/Helper.php', |
|
| 58 | - 'OCA\\Files_Sharing\\Hooks' => __DIR__ . '/..' . '/../lib/Hooks.php', |
|
| 59 | - 'OCA\\Files_Sharing\\ISharedStorage' => __DIR__ . '/..' . '/../lib/ISharedStorage.php', |
|
| 60 | - 'OCA\\Files_Sharing\\Middleware\\OCSShareAPIMiddleware' => __DIR__ . '/..' . '/../lib/Middleware/OCSShareAPIMiddleware.php', |
|
| 61 | - 'OCA\\Files_Sharing\\Middleware\\ShareInfoMiddleware' => __DIR__ . '/..' . '/../lib/Middleware/ShareInfoMiddleware.php', |
|
| 62 | - 'OCA\\Files_Sharing\\Middleware\\SharingCheckMiddleware' => __DIR__ . '/..' . '/../lib/Middleware/SharingCheckMiddleware.php', |
|
| 63 | - 'OCA\\Files_Sharing\\Migration\\OwncloudGuestShareType' => __DIR__ . '/..' . '/../lib/Migration/OwncloudGuestShareType.php', |
|
| 64 | - 'OCA\\Files_Sharing\\Migration\\SetPasswordColumn' => __DIR__ . '/..' . '/../lib/Migration/SetPasswordColumn.php', |
|
| 65 | - 'OCA\\Files_Sharing\\MountProvider' => __DIR__ . '/..' . '/../lib/MountProvider.php', |
|
| 66 | - 'OCA\\Files_Sharing\\Scanner' => __DIR__ . '/..' . '/../lib/Scanner.php', |
|
| 67 | - 'OCA\\Files_Sharing\\ShareBackend\\File' => __DIR__ . '/..' . '/../lib/ShareBackend/File.php', |
|
| 68 | - 'OCA\\Files_Sharing\\ShareBackend\\Folder' => __DIR__ . '/..' . '/../lib/ShareBackend/Folder.php', |
|
| 69 | - 'OCA\\Files_Sharing\\SharedMount' => __DIR__ . '/..' . '/../lib/SharedMount.php', |
|
| 70 | - 'OCA\\Files_Sharing\\SharedStorage' => __DIR__ . '/..' . '/../lib/SharedStorage.php', |
|
| 71 | - 'OCA\\Files_Sharing\\Updater' => __DIR__ . '/..' . '/../lib/Updater.php', |
|
| 23 | + public static $classMap = array( |
|
| 24 | + 'OCA\\Files_Sharing\\Activity\\Filter' => __DIR__.'/..'.'/../lib/Activity/Filter.php', |
|
| 25 | + 'OCA\\Files_Sharing\\Activity\\Providers\\Base' => __DIR__.'/..'.'/../lib/Activity/Providers/Base.php', |
|
| 26 | + 'OCA\\Files_Sharing\\Activity\\Providers\\Downloads' => __DIR__.'/..'.'/../lib/Activity/Providers/Downloads.php', |
|
| 27 | + 'OCA\\Files_Sharing\\Activity\\Providers\\Groups' => __DIR__.'/..'.'/../lib/Activity/Providers/Groups.php', |
|
| 28 | + 'OCA\\Files_Sharing\\Activity\\Providers\\PublicLinks' => __DIR__.'/..'.'/../lib/Activity/Providers/PublicLinks.php', |
|
| 29 | + 'OCA\\Files_Sharing\\Activity\\Providers\\RemoteShares' => __DIR__.'/..'.'/../lib/Activity/Providers/RemoteShares.php', |
|
| 30 | + 'OCA\\Files_Sharing\\Activity\\Providers\\Users' => __DIR__.'/..'.'/../lib/Activity/Providers/Users.php', |
|
| 31 | + 'OCA\\Files_Sharing\\Activity\\Settings\\PublicLinks' => __DIR__.'/..'.'/../lib/Activity/Settings/PublicLinks.php', |
|
| 32 | + 'OCA\\Files_Sharing\\Activity\\Settings\\RemoteShare' => __DIR__.'/..'.'/../lib/Activity/Settings/RemoteShare.php', |
|
| 33 | + 'OCA\\Files_Sharing\\Activity\\Settings\\Shared' => __DIR__.'/..'.'/../lib/Activity/Settings/Shared.php', |
|
| 34 | + 'OCA\\Files_Sharing\\AppInfo\\Application' => __DIR__.'/..'.'/../lib/AppInfo/Application.php', |
|
| 35 | + 'OCA\\Files_Sharing\\Cache' => __DIR__.'/..'.'/../lib/Cache.php', |
|
| 36 | + 'OCA\\Files_Sharing\\Capabilities' => __DIR__.'/..'.'/../lib/Capabilities.php', |
|
| 37 | + 'OCA\\Files_Sharing\\Collaboration\\ShareRecipientSorter' => __DIR__.'/..'.'/../lib/Collaboration/ShareRecipientSorter.php', |
|
| 38 | + 'OCA\\Files_Sharing\\Command\\CleanupRemoteStorages' => __DIR__.'/..'.'/../lib/Command/CleanupRemoteStorages.php', |
|
| 39 | + 'OCA\\Files_Sharing\\Controller\\ExternalSharesController' => __DIR__.'/..'.'/../lib/Controller/ExternalSharesController.php', |
|
| 40 | + 'OCA\\Files_Sharing\\Controller\\PublicPreviewController' => __DIR__.'/..'.'/../lib/Controller/PublicPreviewController.php', |
|
| 41 | + 'OCA\\Files_Sharing\\Controller\\RemoteController' => __DIR__.'/..'.'/../lib/Controller/RemoteController.php', |
|
| 42 | + 'OCA\\Files_Sharing\\Controller\\ShareAPIController' => __DIR__.'/..'.'/../lib/Controller/ShareAPIController.php', |
|
| 43 | + 'OCA\\Files_Sharing\\Controller\\ShareController' => __DIR__.'/..'.'/../lib/Controller/ShareController.php', |
|
| 44 | + 'OCA\\Files_Sharing\\Controller\\ShareInfoController' => __DIR__.'/..'.'/../lib/Controller/ShareInfoController.php', |
|
| 45 | + 'OCA\\Files_Sharing\\Controller\\ShareesAPIController' => __DIR__.'/..'.'/../lib/Controller/ShareesAPIController.php', |
|
| 46 | + 'OCA\\Files_Sharing\\DeleteOrphanedSharesJob' => __DIR__.'/..'.'/../lib/DeleteOrphanedSharesJob.php', |
|
| 47 | + 'OCA\\Files_Sharing\\Exceptions\\BrokenPath' => __DIR__.'/..'.'/../lib/Exceptions/BrokenPath.php', |
|
| 48 | + 'OCA\\Files_Sharing\\Exceptions\\S2SException' => __DIR__.'/..'.'/../lib/Exceptions/S2SException.php', |
|
| 49 | + 'OCA\\Files_Sharing\\ExpireSharesJob' => __DIR__.'/..'.'/../lib/ExpireSharesJob.php', |
|
| 50 | + 'OCA\\Files_Sharing\\External\\Cache' => __DIR__.'/..'.'/../lib/External/Cache.php', |
|
| 51 | + 'OCA\\Files_Sharing\\External\\Manager' => __DIR__.'/..'.'/../lib/External/Manager.php', |
|
| 52 | + 'OCA\\Files_Sharing\\External\\Mount' => __DIR__.'/..'.'/../lib/External/Mount.php', |
|
| 53 | + 'OCA\\Files_Sharing\\External\\MountProvider' => __DIR__.'/..'.'/../lib/External/MountProvider.php', |
|
| 54 | + 'OCA\\Files_Sharing\\External\\Scanner' => __DIR__.'/..'.'/../lib/External/Scanner.php', |
|
| 55 | + 'OCA\\Files_Sharing\\External\\Storage' => __DIR__.'/..'.'/../lib/External/Storage.php', |
|
| 56 | + 'OCA\\Files_Sharing\\External\\Watcher' => __DIR__.'/..'.'/../lib/External/Watcher.php', |
|
| 57 | + 'OCA\\Files_Sharing\\Helper' => __DIR__.'/..'.'/../lib/Helper.php', |
|
| 58 | + 'OCA\\Files_Sharing\\Hooks' => __DIR__.'/..'.'/../lib/Hooks.php', |
|
| 59 | + 'OCA\\Files_Sharing\\ISharedStorage' => __DIR__.'/..'.'/../lib/ISharedStorage.php', |
|
| 60 | + 'OCA\\Files_Sharing\\Middleware\\OCSShareAPIMiddleware' => __DIR__.'/..'.'/../lib/Middleware/OCSShareAPIMiddleware.php', |
|
| 61 | + 'OCA\\Files_Sharing\\Middleware\\ShareInfoMiddleware' => __DIR__.'/..'.'/../lib/Middleware/ShareInfoMiddleware.php', |
|
| 62 | + 'OCA\\Files_Sharing\\Middleware\\SharingCheckMiddleware' => __DIR__.'/..'.'/../lib/Middleware/SharingCheckMiddleware.php', |
|
| 63 | + 'OCA\\Files_Sharing\\Migration\\OwncloudGuestShareType' => __DIR__.'/..'.'/../lib/Migration/OwncloudGuestShareType.php', |
|
| 64 | + 'OCA\\Files_Sharing\\Migration\\SetPasswordColumn' => __DIR__.'/..'.'/../lib/Migration/SetPasswordColumn.php', |
|
| 65 | + 'OCA\\Files_Sharing\\MountProvider' => __DIR__.'/..'.'/../lib/MountProvider.php', |
|
| 66 | + 'OCA\\Files_Sharing\\Scanner' => __DIR__.'/..'.'/../lib/Scanner.php', |
|
| 67 | + 'OCA\\Files_Sharing\\ShareBackend\\File' => __DIR__.'/..'.'/../lib/ShareBackend/File.php', |
|
| 68 | + 'OCA\\Files_Sharing\\ShareBackend\\Folder' => __DIR__.'/..'.'/../lib/ShareBackend/Folder.php', |
|
| 69 | + 'OCA\\Files_Sharing\\SharedMount' => __DIR__.'/..'.'/../lib/SharedMount.php', |
|
| 70 | + 'OCA\\Files_Sharing\\SharedStorage' => __DIR__.'/..'.'/../lib/SharedStorage.php', |
|
| 71 | + 'OCA\\Files_Sharing\\Updater' => __DIR__.'/..'.'/../lib/Updater.php', |
|
| 72 | 72 | ); |
| 73 | 73 | |
| 74 | 74 | public static function getInitializer(ClassLoader $loader) |
| 75 | 75 | { |
| 76 | - return \Closure::bind(function () use ($loader) { |
|
| 76 | + return \Closure::bind(function() use ($loader) { |
|
| 77 | 77 | $loader->prefixLengthsPsr4 = ComposerStaticInitFiles_Sharing::$prefixLengthsPsr4; |
| 78 | 78 | $loader->prefixDirsPsr4 = ComposerStaticInitFiles_Sharing::$prefixDirsPsr4; |
| 79 | 79 | $loader->classMap = ComposerStaticInitFiles_Sharing::$classMap; |