@@ -33,64 +33,64 @@ |
||
| 33 | 33 | |
| 34 | 34 | class Admin implements ISettings { |
| 35 | 35 | |
| 36 | - /** @var IManager */ |
|
| 37 | - private $encryptionManager; |
|
| 36 | + /** @var IManager */ |
|
| 37 | + private $encryptionManager; |
|
| 38 | 38 | |
| 39 | - /** @var GlobalStoragesService */ |
|
| 40 | - private $globalStoragesService; |
|
| 39 | + /** @var GlobalStoragesService */ |
|
| 40 | + private $globalStoragesService; |
|
| 41 | 41 | |
| 42 | - /** @var BackendService */ |
|
| 43 | - private $backendService; |
|
| 42 | + /** @var BackendService */ |
|
| 43 | + private $backendService; |
|
| 44 | 44 | |
| 45 | - /** @var GlobalAuth */ |
|
| 46 | - private $globalAuth; |
|
| 45 | + /** @var GlobalAuth */ |
|
| 46 | + private $globalAuth; |
|
| 47 | 47 | |
| 48 | - public function __construct( |
|
| 49 | - IManager $encryptionManager, |
|
| 50 | - GlobalStoragesService $globalStoragesService, |
|
| 51 | - BackendService $backendService, |
|
| 52 | - GlobalAuth $globalAuth |
|
| 53 | - ) { |
|
| 54 | - $this->encryptionManager = $encryptionManager; |
|
| 55 | - $this->globalStoragesService = $globalStoragesService; |
|
| 56 | - $this->backendService = $backendService; |
|
| 57 | - $this->globalAuth = $globalAuth; |
|
| 58 | - } |
|
| 48 | + public function __construct( |
|
| 49 | + IManager $encryptionManager, |
|
| 50 | + GlobalStoragesService $globalStoragesService, |
|
| 51 | + BackendService $backendService, |
|
| 52 | + GlobalAuth $globalAuth |
|
| 53 | + ) { |
|
| 54 | + $this->encryptionManager = $encryptionManager; |
|
| 55 | + $this->globalStoragesService = $globalStoragesService; |
|
| 56 | + $this->backendService = $backendService; |
|
| 57 | + $this->globalAuth = $globalAuth; |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * @return TemplateResponse |
|
| 62 | - */ |
|
| 63 | - public function getForm() { |
|
| 64 | - $parameters = [ |
|
| 65 | - 'encryptionEnabled' => $this->encryptionManager->isEnabled(), |
|
| 66 | - 'visibilityType' => BackendService::VISIBILITY_ADMIN, |
|
| 67 | - 'storages' => $this->globalStoragesService->getStorages(), |
|
| 68 | - 'backends' => $this->backendService->getAvailableBackends(), |
|
| 69 | - 'authMechanisms' => $this->backendService->getAuthMechanisms(), |
|
| 70 | - 'dependencies' => \OCA\Files_External\MountConfig::dependencyMessage($this->backendService->getBackends()), |
|
| 71 | - 'allowUserMounting' => $this->backendService->isUserMountingAllowed(), |
|
| 72 | - 'globalCredentials' => $this->globalAuth->getAuth(''), |
|
| 73 | - 'globalCredentialsUid' => '', |
|
| 74 | - ]; |
|
| 60 | + /** |
|
| 61 | + * @return TemplateResponse |
|
| 62 | + */ |
|
| 63 | + public function getForm() { |
|
| 64 | + $parameters = [ |
|
| 65 | + 'encryptionEnabled' => $this->encryptionManager->isEnabled(), |
|
| 66 | + 'visibilityType' => BackendService::VISIBILITY_ADMIN, |
|
| 67 | + 'storages' => $this->globalStoragesService->getStorages(), |
|
| 68 | + 'backends' => $this->backendService->getAvailableBackends(), |
|
| 69 | + 'authMechanisms' => $this->backendService->getAuthMechanisms(), |
|
| 70 | + 'dependencies' => \OCA\Files_External\MountConfig::dependencyMessage($this->backendService->getBackends()), |
|
| 71 | + 'allowUserMounting' => $this->backendService->isUserMountingAllowed(), |
|
| 72 | + 'globalCredentials' => $this->globalAuth->getAuth(''), |
|
| 73 | + 'globalCredentialsUid' => '', |
|
| 74 | + ]; |
|
| 75 | 75 | |
| 76 | - return new TemplateResponse('files_external', 'settings', $parameters, ''); |
|
| 77 | - } |
|
| 76 | + return new TemplateResponse('files_external', 'settings', $parameters, ''); |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - /** |
|
| 80 | - * @return string the section ID, e.g. 'sharing' |
|
| 81 | - */ |
|
| 82 | - public function getSection() { |
|
| 83 | - return 'externalstorages'; |
|
| 84 | - } |
|
| 79 | + /** |
|
| 80 | + * @return string the section ID, e.g. 'sharing' |
|
| 81 | + */ |
|
| 82 | + public function getSection() { |
|
| 83 | + return 'externalstorages'; |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - /** |
|
| 87 | - * @return int whether the form should be rather on the top or bottom of |
|
| 88 | - * the admin section. The forms are arranged in ascending order of the |
|
| 89 | - * priority values. It is required to return a value between 0 and 100. |
|
| 90 | - * |
|
| 91 | - * E.g.: 70 |
|
| 92 | - */ |
|
| 93 | - public function getPriority() { |
|
| 94 | - return 40; |
|
| 95 | - } |
|
| 86 | + /** |
|
| 87 | + * @return int whether the form should be rather on the top or bottom of |
|
| 88 | + * the admin section. The forms are arranged in ascending order of the |
|
| 89 | + * priority values. It is required to return a value between 0 and 100. |
|
| 90 | + * |
|
| 91 | + * E.g.: 70 |
|
| 92 | + */ |
|
| 93 | + public function getPriority() { |
|
| 94 | + return 40; |
|
| 95 | + } |
|
| 96 | 96 | } |
@@ -34,71 +34,71 @@ |
||
| 34 | 34 | |
| 35 | 35 | class Personal implements ISettings { |
| 36 | 36 | |
| 37 | - /** @var IManager */ |
|
| 38 | - private $encryptionManager; |
|
| 37 | + /** @var IManager */ |
|
| 38 | + private $encryptionManager; |
|
| 39 | 39 | |
| 40 | - /** @var UserGlobalStoragesService */ |
|
| 41 | - private $userGlobalStoragesService; |
|
| 40 | + /** @var UserGlobalStoragesService */ |
|
| 41 | + private $userGlobalStoragesService; |
|
| 42 | 42 | |
| 43 | - /** @var BackendService */ |
|
| 44 | - private $backendService; |
|
| 43 | + /** @var BackendService */ |
|
| 44 | + private $backendService; |
|
| 45 | 45 | |
| 46 | - /** @var GlobalAuth */ |
|
| 47 | - private $globalAuth; |
|
| 46 | + /** @var GlobalAuth */ |
|
| 47 | + private $globalAuth; |
|
| 48 | 48 | |
| 49 | - /** @var IUserSession */ |
|
| 50 | - private $userSession; |
|
| 49 | + /** @var IUserSession */ |
|
| 50 | + private $userSession; |
|
| 51 | 51 | |
| 52 | - public function __construct( |
|
| 53 | - IManager $encryptionManager, |
|
| 54 | - UserGlobalStoragesService $userGlobalStoragesService, |
|
| 55 | - BackendService $backendService, |
|
| 56 | - GlobalAuth $globalAuth, |
|
| 57 | - IUserSession $userSession |
|
| 58 | - ) { |
|
| 59 | - $this->encryptionManager = $encryptionManager; |
|
| 60 | - $this->userGlobalStoragesService = $userGlobalStoragesService; |
|
| 61 | - $this->backendService = $backendService; |
|
| 62 | - $this->globalAuth = $globalAuth; |
|
| 63 | - $this->userSession = $userSession; |
|
| 64 | - } |
|
| 52 | + public function __construct( |
|
| 53 | + IManager $encryptionManager, |
|
| 54 | + UserGlobalStoragesService $userGlobalStoragesService, |
|
| 55 | + BackendService $backendService, |
|
| 56 | + GlobalAuth $globalAuth, |
|
| 57 | + IUserSession $userSession |
|
| 58 | + ) { |
|
| 59 | + $this->encryptionManager = $encryptionManager; |
|
| 60 | + $this->userGlobalStoragesService = $userGlobalStoragesService; |
|
| 61 | + $this->backendService = $backendService; |
|
| 62 | + $this->globalAuth = $globalAuth; |
|
| 63 | + $this->userSession = $userSession; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * @return TemplateResponse |
|
| 68 | - */ |
|
| 69 | - public function getForm() { |
|
| 70 | - $uid = $this->userSession->getUser()->getUID(); |
|
| 66 | + /** |
|
| 67 | + * @return TemplateResponse |
|
| 68 | + */ |
|
| 69 | + public function getForm() { |
|
| 70 | + $uid = $this->userSession->getUser()->getUID(); |
|
| 71 | 71 | |
| 72 | - $parameters = [ |
|
| 73 | - 'encryptionEnabled' => $this->encryptionManager->isEnabled(), |
|
| 74 | - 'visibilityType' => BackendService::VISIBILITY_PERSONAL, |
|
| 75 | - 'storages' => $this->userGlobalStoragesService->getStorages(), |
|
| 76 | - 'backends' => $this->backendService->getAvailableBackends(), |
|
| 77 | - 'authMechanisms' => $this->backendService->getAuthMechanisms(), |
|
| 78 | - 'dependencies' => \OCA\Files_External\MountConfig::dependencyMessage($this->backendService->getBackends()), |
|
| 79 | - 'allowUserMounting' => $this->backendService->isUserMountingAllowed(), |
|
| 80 | - 'globalCredentials' => $this->globalAuth->getAuth($uid), |
|
| 81 | - 'globalCredentialsUid' => $uid, |
|
| 82 | - ]; |
|
| 72 | + $parameters = [ |
|
| 73 | + 'encryptionEnabled' => $this->encryptionManager->isEnabled(), |
|
| 74 | + 'visibilityType' => BackendService::VISIBILITY_PERSONAL, |
|
| 75 | + 'storages' => $this->userGlobalStoragesService->getStorages(), |
|
| 76 | + 'backends' => $this->backendService->getAvailableBackends(), |
|
| 77 | + 'authMechanisms' => $this->backendService->getAuthMechanisms(), |
|
| 78 | + 'dependencies' => \OCA\Files_External\MountConfig::dependencyMessage($this->backendService->getBackends()), |
|
| 79 | + 'allowUserMounting' => $this->backendService->isUserMountingAllowed(), |
|
| 80 | + 'globalCredentials' => $this->globalAuth->getAuth($uid), |
|
| 81 | + 'globalCredentialsUid' => $uid, |
|
| 82 | + ]; |
|
| 83 | 83 | |
| 84 | - return new TemplateResponse('files_external', 'settings', $parameters, ''); |
|
| 85 | - } |
|
| 84 | + return new TemplateResponse('files_external', 'settings', $parameters, ''); |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - /** |
|
| 88 | - * @return string the section ID, e.g. 'sharing' |
|
| 89 | - */ |
|
| 90 | - public function getSection() { |
|
| 91 | - return 'externalstorages'; |
|
| 92 | - } |
|
| 87 | + /** |
|
| 88 | + * @return string the section ID, e.g. 'sharing' |
|
| 89 | + */ |
|
| 90 | + public function getSection() { |
|
| 91 | + return 'externalstorages'; |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | - /** |
|
| 95 | - * @return int whether the form should be rather on the top or bottom of |
|
| 96 | - * the admin section. The forms are arranged in ascending order of the |
|
| 97 | - * priority values. It is required to return a value between 0 and 100. |
|
| 98 | - * |
|
| 99 | - * E.g.: 70 |
|
| 100 | - */ |
|
| 101 | - public function getPriority() { |
|
| 102 | - return 40; |
|
| 103 | - } |
|
| 94 | + /** |
|
| 95 | + * @return int whether the form should be rather on the top or bottom of |
|
| 96 | + * the admin section. The forms are arranged in ascending order of the |
|
| 97 | + * priority values. It is required to return a value between 0 and 100. |
|
| 98 | + * |
|
| 99 | + * E.g.: 70 |
|
| 100 | + */ |
|
| 101 | + public function getPriority() { |
|
| 102 | + return 40; |
|
| 103 | + } |
|
| 104 | 104 | } |
@@ -32,60 +32,60 @@ |
||
| 32 | 32 | use OC\Updater\VersionCheck; |
| 33 | 33 | |
| 34 | 34 | class UpdateChecker { |
| 35 | - /** @var VersionCheck */ |
|
| 36 | - private $updater; |
|
| 37 | - /** @var ChangesCheck */ |
|
| 38 | - private $changesCheck; |
|
| 35 | + /** @var VersionCheck */ |
|
| 36 | + private $updater; |
|
| 37 | + /** @var ChangesCheck */ |
|
| 38 | + private $changesCheck; |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @param VersionCheck $updater |
|
| 42 | - */ |
|
| 43 | - public function __construct(VersionCheck $updater, ChangesCheck $changesCheck) { |
|
| 44 | - $this->updater = $updater; |
|
| 45 | - $this->changesCheck = $changesCheck; |
|
| 46 | - } |
|
| 40 | + /** |
|
| 41 | + * @param VersionCheck $updater |
|
| 42 | + */ |
|
| 43 | + public function __construct(VersionCheck $updater, ChangesCheck $changesCheck) { |
|
| 44 | + $this->updater = $updater; |
|
| 45 | + $this->changesCheck = $changesCheck; |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * @return array |
|
| 50 | - */ |
|
| 51 | - public function getUpdateState(): array { |
|
| 52 | - $data = $this->updater->check(); |
|
| 53 | - $result = []; |
|
| 48 | + /** |
|
| 49 | + * @return array |
|
| 50 | + */ |
|
| 51 | + public function getUpdateState(): array { |
|
| 52 | + $data = $this->updater->check(); |
|
| 53 | + $result = []; |
|
| 54 | 54 | |
| 55 | - if (isset($data['version']) && $data['version'] !== '' && $data['version'] !== []) { |
|
| 56 | - $result['updateAvailable'] = true; |
|
| 57 | - $result['updateVersion'] = $data['version']; |
|
| 58 | - $result['updateVersionString'] = $data['versionstring']; |
|
| 59 | - $result['updaterEnabled'] = $data['autoupdater'] === '1'; |
|
| 60 | - $result['versionIsEol'] = $data['eol'] === '1'; |
|
| 61 | - if (strpos($data['web'], 'https://') === 0) { |
|
| 62 | - $result['updateLink'] = $data['web']; |
|
| 63 | - } |
|
| 64 | - if (strpos($data['url'], 'https://') === 0) { |
|
| 65 | - $result['downloadLink'] = $data['url']; |
|
| 66 | - } |
|
| 67 | - if (strpos($data['changes'], 'https://') === 0) { |
|
| 68 | - try { |
|
| 69 | - $result['changes'] = $this->changesCheck->check($data['changes'], $data['version']); |
|
| 70 | - } catch (\Exception $e) { |
|
| 71 | - // no info, not a problem |
|
| 72 | - } |
|
| 73 | - } |
|
| 55 | + if (isset($data['version']) && $data['version'] !== '' && $data['version'] !== []) { |
|
| 56 | + $result['updateAvailable'] = true; |
|
| 57 | + $result['updateVersion'] = $data['version']; |
|
| 58 | + $result['updateVersionString'] = $data['versionstring']; |
|
| 59 | + $result['updaterEnabled'] = $data['autoupdater'] === '1'; |
|
| 60 | + $result['versionIsEol'] = $data['eol'] === '1'; |
|
| 61 | + if (strpos($data['web'], 'https://') === 0) { |
|
| 62 | + $result['updateLink'] = $data['web']; |
|
| 63 | + } |
|
| 64 | + if (strpos($data['url'], 'https://') === 0) { |
|
| 65 | + $result['downloadLink'] = $data['url']; |
|
| 66 | + } |
|
| 67 | + if (strpos($data['changes'], 'https://') === 0) { |
|
| 68 | + try { |
|
| 69 | + $result['changes'] = $this->changesCheck->check($data['changes'], $data['version']); |
|
| 70 | + } catch (\Exception $e) { |
|
| 71 | + // no info, not a problem |
|
| 72 | + } |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - return $result; |
|
| 76 | - } |
|
| 75 | + return $result; |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - return []; |
|
| 79 | - } |
|
| 78 | + return []; |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * @param array $data |
|
| 83 | - */ |
|
| 84 | - public function populateJavaScriptVariables(array $data) { |
|
| 85 | - $data['array']['oc_updateState'] = json_encode([ |
|
| 86 | - 'updateAvailable' => true, |
|
| 87 | - 'updateVersion' => $this->getUpdateState()['updateVersionString'], |
|
| 88 | - 'updateLink' => $this->getUpdateState()['updateLink'] ?? '', |
|
| 89 | - ]); |
|
| 90 | - } |
|
| 81 | + /** |
|
| 82 | + * @param array $data |
|
| 83 | + */ |
|
| 84 | + public function populateJavaScriptVariables(array $data) { |
|
| 85 | + $data['array']['oc_updateState'] = json_encode([ |
|
| 86 | + 'updateAvailable' => true, |
|
| 87 | + 'updateVersion' => $this->getUpdateState()['updateVersionString'], |
|
| 88 | + 'updateLink' => $this->getUpdateState()['updateLink'] ?? '', |
|
| 89 | + ]); |
|
| 90 | + } |
|
| 91 | 91 | } |
@@ -38,69 +38,69 @@ |
||
| 38 | 38 | |
| 39 | 39 | class HasPhotoPlugin extends ServerPlugin { |
| 40 | 40 | |
| 41 | - /** @var Server */ |
|
| 42 | - protected $server; |
|
| 41 | + /** @var Server */ |
|
| 42 | + protected $server; |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Initializes the plugin and registers event handlers |
|
| 46 | - * |
|
| 47 | - * @param Server $server |
|
| 48 | - * @return void |
|
| 49 | - */ |
|
| 50 | - public function initialize(Server $server) { |
|
| 51 | - $server->on('propFind', [$this, 'propFind']); |
|
| 52 | - } |
|
| 44 | + /** |
|
| 45 | + * Initializes the plugin and registers event handlers |
|
| 46 | + * |
|
| 47 | + * @param Server $server |
|
| 48 | + * @return void |
|
| 49 | + */ |
|
| 50 | + public function initialize(Server $server) { |
|
| 51 | + $server->on('propFind', [$this, 'propFind']); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Adds all CardDAV-specific properties |
|
| 56 | - * |
|
| 57 | - * @param PropFind $propFind |
|
| 58 | - * @param INode $node |
|
| 59 | - * @return void |
|
| 60 | - */ |
|
| 61 | - public function propFind(PropFind $propFind, INode $node) { |
|
| 62 | - $ns = '{http://nextcloud.com/ns}'; |
|
| 54 | + /** |
|
| 55 | + * Adds all CardDAV-specific properties |
|
| 56 | + * |
|
| 57 | + * @param PropFind $propFind |
|
| 58 | + * @param INode $node |
|
| 59 | + * @return void |
|
| 60 | + */ |
|
| 61 | + public function propFind(PropFind $propFind, INode $node) { |
|
| 62 | + $ns = '{http://nextcloud.com/ns}'; |
|
| 63 | 63 | |
| 64 | - if ($node instanceof Card) { |
|
| 65 | - $propFind->handle($ns . 'has-photo', function () use ($node) { |
|
| 66 | - $vcard = Reader::read($node->get()); |
|
| 67 | - return $vcard instanceof VCard |
|
| 68 | - && $vcard->PHOTO |
|
| 69 | - // Either the PHOTO is a url (doesn't start with data:) or the mimetype has to start with image/ |
|
| 70 | - && (strpos($vcard->PHOTO->getValue(), 'data:') !== 0 |
|
| 71 | - || strpos($vcard->PHOTO->getValue(), 'data:image/') === 0) |
|
| 72 | - ; |
|
| 73 | - }); |
|
| 74 | - } |
|
| 75 | - } |
|
| 64 | + if ($node instanceof Card) { |
|
| 65 | + $propFind->handle($ns . 'has-photo', function () use ($node) { |
|
| 66 | + $vcard = Reader::read($node->get()); |
|
| 67 | + return $vcard instanceof VCard |
|
| 68 | + && $vcard->PHOTO |
|
| 69 | + // Either the PHOTO is a url (doesn't start with data:) or the mimetype has to start with image/ |
|
| 70 | + && (strpos($vcard->PHOTO->getValue(), 'data:') !== 0 |
|
| 71 | + || strpos($vcard->PHOTO->getValue(), 'data:image/') === 0) |
|
| 72 | + ; |
|
| 73 | + }); |
|
| 74 | + } |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - /** |
|
| 78 | - * Returns a plugin name. |
|
| 79 | - * |
|
| 80 | - * Using this name other plugins will be able to access other plugins |
|
| 81 | - * using \Sabre\DAV\Server::getPlugin |
|
| 82 | - * |
|
| 83 | - * @return string |
|
| 84 | - */ |
|
| 85 | - public function getPluginName() { |
|
| 86 | - return 'vcard-has-photo'; |
|
| 87 | - } |
|
| 77 | + /** |
|
| 78 | + * Returns a plugin name. |
|
| 79 | + * |
|
| 80 | + * Using this name other plugins will be able to access other plugins |
|
| 81 | + * using \Sabre\DAV\Server::getPlugin |
|
| 82 | + * |
|
| 83 | + * @return string |
|
| 84 | + */ |
|
| 85 | + public function getPluginName() { |
|
| 86 | + return 'vcard-has-photo'; |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - /** |
|
| 90 | - * Returns a bunch of meta-data about the plugin. |
|
| 91 | - * |
|
| 92 | - * Providing this information is optional, and is mainly displayed by the |
|
| 93 | - * Browser plugin. |
|
| 94 | - * |
|
| 95 | - * The description key in the returned array may contain html and will not |
|
| 96 | - * be sanitized. |
|
| 97 | - * |
|
| 98 | - * @return array |
|
| 99 | - */ |
|
| 100 | - public function getPluginInfo() { |
|
| 101 | - return [ |
|
| 102 | - 'name' => $this->getPluginName(), |
|
| 103 | - 'description' => 'Return a boolean stating if the vcard have a photo property set or not.' |
|
| 104 | - ]; |
|
| 105 | - } |
|
| 89 | + /** |
|
| 90 | + * Returns a bunch of meta-data about the plugin. |
|
| 91 | + * |
|
| 92 | + * Providing this information is optional, and is mainly displayed by the |
|
| 93 | + * Browser plugin. |
|
| 94 | + * |
|
| 95 | + * The description key in the returned array may contain html and will not |
|
| 96 | + * be sanitized. |
|
| 97 | + * |
|
| 98 | + * @return array |
|
| 99 | + */ |
|
| 100 | + public function getPluginInfo() { |
|
| 101 | + return [ |
|
| 102 | + 'name' => $this->getPluginName(), |
|
| 103 | + 'description' => 'Return a boolean stating if the vcard have a photo property set or not.' |
|
| 104 | + ]; |
|
| 105 | + } |
|
| 106 | 106 | } |
@@ -37,45 +37,45 @@ |
||
| 37 | 37 | * @package OCA\DAV\CalDAV\Proxy |
| 38 | 38 | */ |
| 39 | 39 | class ProxyMapper extends QBMapper { |
| 40 | - public const PERMISSION_READ = 1; |
|
| 41 | - public const PERMISSION_WRITE = 2; |
|
| 40 | + public const PERMISSION_READ = 1; |
|
| 41 | + public const PERMISSION_WRITE = 2; |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * ProxyMapper constructor. |
|
| 45 | - * |
|
| 46 | - * @param IDBConnection $db |
|
| 47 | - */ |
|
| 48 | - public function __construct(IDBConnection $db) { |
|
| 49 | - parent::__construct($db, 'dav_cal_proxy', Proxy::class); |
|
| 50 | - } |
|
| 43 | + /** |
|
| 44 | + * ProxyMapper constructor. |
|
| 45 | + * |
|
| 46 | + * @param IDBConnection $db |
|
| 47 | + */ |
|
| 48 | + public function __construct(IDBConnection $db) { |
|
| 49 | + parent::__construct($db, 'dav_cal_proxy', Proxy::class); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * @param string $proxyId The principal uri that can act as a proxy for the resulting calendars |
|
| 54 | - * |
|
| 55 | - * @return Proxy[] |
|
| 56 | - */ |
|
| 57 | - public function getProxiesFor(string $proxyId): array { |
|
| 58 | - $qb = $this->db->getQueryBuilder(); |
|
| 52 | + /** |
|
| 53 | + * @param string $proxyId The principal uri that can act as a proxy for the resulting calendars |
|
| 54 | + * |
|
| 55 | + * @return Proxy[] |
|
| 56 | + */ |
|
| 57 | + public function getProxiesFor(string $proxyId): array { |
|
| 58 | + $qb = $this->db->getQueryBuilder(); |
|
| 59 | 59 | |
| 60 | - $qb->select('*') |
|
| 61 | - ->from($this->getTableName()) |
|
| 62 | - ->where($qb->expr()->eq('proxy_id', $qb->createNamedParameter($proxyId))); |
|
| 60 | + $qb->select('*') |
|
| 61 | + ->from($this->getTableName()) |
|
| 62 | + ->where($qb->expr()->eq('proxy_id', $qb->createNamedParameter($proxyId))); |
|
| 63 | 63 | |
| 64 | - return $this->findEntities($qb); |
|
| 65 | - } |
|
| 64 | + return $this->findEntities($qb); |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * @param string $ownerId The principal uri that has the resulting proxies for their calendars |
|
| 69 | - * |
|
| 70 | - * @return Proxy[] |
|
| 71 | - */ |
|
| 72 | - public function getProxiesOf(string $ownerId): array { |
|
| 73 | - $qb = $this->db->getQueryBuilder(); |
|
| 67 | + /** |
|
| 68 | + * @param string $ownerId The principal uri that has the resulting proxies for their calendars |
|
| 69 | + * |
|
| 70 | + * @return Proxy[] |
|
| 71 | + */ |
|
| 72 | + public function getProxiesOf(string $ownerId): array { |
|
| 73 | + $qb = $this->db->getQueryBuilder(); |
|
| 74 | 74 | |
| 75 | - $qb->select('*') |
|
| 76 | - ->from($this->getTableName()) |
|
| 77 | - ->where($qb->expr()->eq('owner_id', $qb->createNamedParameter($ownerId))); |
|
| 75 | + $qb->select('*') |
|
| 76 | + ->from($this->getTableName()) |
|
| 77 | + ->where($qb->expr()->eq('owner_id', $qb->createNamedParameter($ownerId))); |
|
| 78 | 78 | |
| 79 | - return $this->findEntities($qb); |
|
| 80 | - } |
|
| 79 | + return $this->findEntities($qb); |
|
| 80 | + } |
|
| 81 | 81 | } |
@@ -33,128 +33,128 @@ |
||
| 33 | 33 | use Symfony\Component\Routing\Route as SymfonyRoute; |
| 34 | 34 | |
| 35 | 35 | class Route extends SymfonyRoute implements IRoute { |
| 36 | - /** |
|
| 37 | - * Specify the method when this route is to be used |
|
| 38 | - * |
|
| 39 | - * @param string $method HTTP method (uppercase) |
|
| 40 | - * @return \OC\Route\Route |
|
| 41 | - */ |
|
| 42 | - public function method($method) { |
|
| 43 | - $this->setMethods($method); |
|
| 44 | - return $this; |
|
| 45 | - } |
|
| 36 | + /** |
|
| 37 | + * Specify the method when this route is to be used |
|
| 38 | + * |
|
| 39 | + * @param string $method HTTP method (uppercase) |
|
| 40 | + * @return \OC\Route\Route |
|
| 41 | + */ |
|
| 42 | + public function method($method) { |
|
| 43 | + $this->setMethods($method); |
|
| 44 | + return $this; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Specify POST as the method to use with this route |
|
| 49 | - * @return \OC\Route\Route |
|
| 50 | - */ |
|
| 51 | - public function post() { |
|
| 52 | - $this->method('POST'); |
|
| 53 | - return $this; |
|
| 54 | - } |
|
| 47 | + /** |
|
| 48 | + * Specify POST as the method to use with this route |
|
| 49 | + * @return \OC\Route\Route |
|
| 50 | + */ |
|
| 51 | + public function post() { |
|
| 52 | + $this->method('POST'); |
|
| 53 | + return $this; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * Specify GET as the method to use with this route |
|
| 58 | - * @return \OC\Route\Route |
|
| 59 | - */ |
|
| 60 | - public function get() { |
|
| 61 | - $this->method('GET'); |
|
| 62 | - return $this; |
|
| 63 | - } |
|
| 56 | + /** |
|
| 57 | + * Specify GET as the method to use with this route |
|
| 58 | + * @return \OC\Route\Route |
|
| 59 | + */ |
|
| 60 | + public function get() { |
|
| 61 | + $this->method('GET'); |
|
| 62 | + return $this; |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * Specify PUT as the method to use with this route |
|
| 67 | - * @return \OC\Route\Route |
|
| 68 | - */ |
|
| 69 | - public function put() { |
|
| 70 | - $this->method('PUT'); |
|
| 71 | - return $this; |
|
| 72 | - } |
|
| 65 | + /** |
|
| 66 | + * Specify PUT as the method to use with this route |
|
| 67 | + * @return \OC\Route\Route |
|
| 68 | + */ |
|
| 69 | + public function put() { |
|
| 70 | + $this->method('PUT'); |
|
| 71 | + return $this; |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - /** |
|
| 75 | - * Specify DELETE as the method to use with this route |
|
| 76 | - * @return \OC\Route\Route |
|
| 77 | - */ |
|
| 78 | - public function delete() { |
|
| 79 | - $this->method('DELETE'); |
|
| 80 | - return $this; |
|
| 81 | - } |
|
| 74 | + /** |
|
| 75 | + * Specify DELETE as the method to use with this route |
|
| 76 | + * @return \OC\Route\Route |
|
| 77 | + */ |
|
| 78 | + public function delete() { |
|
| 79 | + $this->method('DELETE'); |
|
| 80 | + return $this; |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * Specify PATCH as the method to use with this route |
|
| 85 | - * @return \OC\Route\Route |
|
| 86 | - */ |
|
| 87 | - public function patch() { |
|
| 88 | - $this->method('PATCH'); |
|
| 89 | - return $this; |
|
| 90 | - } |
|
| 83 | + /** |
|
| 84 | + * Specify PATCH as the method to use with this route |
|
| 85 | + * @return \OC\Route\Route |
|
| 86 | + */ |
|
| 87 | + public function patch() { |
|
| 88 | + $this->method('PATCH'); |
|
| 89 | + return $this; |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - /** |
|
| 93 | - * Defaults to use for this route |
|
| 94 | - * |
|
| 95 | - * @param array $defaults The defaults |
|
| 96 | - * @return \OC\Route\Route |
|
| 97 | - */ |
|
| 98 | - public function defaults($defaults) { |
|
| 99 | - $action = $this->getDefault('action'); |
|
| 100 | - $this->setDefaults($defaults); |
|
| 101 | - if (isset($defaults['action'])) { |
|
| 102 | - $action = $defaults['action']; |
|
| 103 | - } |
|
| 104 | - $this->action($action); |
|
| 105 | - return $this; |
|
| 106 | - } |
|
| 92 | + /** |
|
| 93 | + * Defaults to use for this route |
|
| 94 | + * |
|
| 95 | + * @param array $defaults The defaults |
|
| 96 | + * @return \OC\Route\Route |
|
| 97 | + */ |
|
| 98 | + public function defaults($defaults) { |
|
| 99 | + $action = $this->getDefault('action'); |
|
| 100 | + $this->setDefaults($defaults); |
|
| 101 | + if (isset($defaults['action'])) { |
|
| 102 | + $action = $defaults['action']; |
|
| 103 | + } |
|
| 104 | + $this->action($action); |
|
| 105 | + return $this; |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | - /** |
|
| 109 | - * Requirements for this route |
|
| 110 | - * |
|
| 111 | - * @param array $requirements The requirements |
|
| 112 | - * @return \OC\Route\Route |
|
| 113 | - */ |
|
| 114 | - public function requirements($requirements) { |
|
| 115 | - $method = $this->getMethods(); |
|
| 116 | - $this->setRequirements($requirements); |
|
| 117 | - if (isset($requirements['_method'])) { |
|
| 118 | - $method = $requirements['_method']; |
|
| 119 | - } |
|
| 120 | - if ($method) { |
|
| 121 | - $this->method($method); |
|
| 122 | - } |
|
| 123 | - return $this; |
|
| 124 | - } |
|
| 108 | + /** |
|
| 109 | + * Requirements for this route |
|
| 110 | + * |
|
| 111 | + * @param array $requirements The requirements |
|
| 112 | + * @return \OC\Route\Route |
|
| 113 | + */ |
|
| 114 | + public function requirements($requirements) { |
|
| 115 | + $method = $this->getMethods(); |
|
| 116 | + $this->setRequirements($requirements); |
|
| 117 | + if (isset($requirements['_method'])) { |
|
| 118 | + $method = $requirements['_method']; |
|
| 119 | + } |
|
| 120 | + if ($method) { |
|
| 121 | + $this->method($method); |
|
| 122 | + } |
|
| 123 | + return $this; |
|
| 124 | + } |
|
| 125 | 125 | |
| 126 | - /** |
|
| 127 | - * The action to execute when this route matches |
|
| 128 | - * |
|
| 129 | - * @param string|callable $class the class or a callable |
|
| 130 | - * @param string $function the function to use with the class |
|
| 131 | - * @return \OC\Route\Route |
|
| 132 | - * |
|
| 133 | - * This function is called with $class set to a callable or |
|
| 134 | - * to the class with $function |
|
| 135 | - */ |
|
| 136 | - public function action($class, $function = null) { |
|
| 137 | - $action = [$class, $function]; |
|
| 138 | - if (is_null($function)) { |
|
| 139 | - $action = $class; |
|
| 140 | - } |
|
| 141 | - $this->setDefault('action', $action); |
|
| 142 | - return $this; |
|
| 143 | - } |
|
| 126 | + /** |
|
| 127 | + * The action to execute when this route matches |
|
| 128 | + * |
|
| 129 | + * @param string|callable $class the class or a callable |
|
| 130 | + * @param string $function the function to use with the class |
|
| 131 | + * @return \OC\Route\Route |
|
| 132 | + * |
|
| 133 | + * This function is called with $class set to a callable or |
|
| 134 | + * to the class with $function |
|
| 135 | + */ |
|
| 136 | + public function action($class, $function = null) { |
|
| 137 | + $action = [$class, $function]; |
|
| 138 | + if (is_null($function)) { |
|
| 139 | + $action = $class; |
|
| 140 | + } |
|
| 141 | + $this->setDefault('action', $action); |
|
| 142 | + return $this; |
|
| 143 | + } |
|
| 144 | 144 | |
| 145 | - /** |
|
| 146 | - * The action to execute when this route matches, includes a file like |
|
| 147 | - * it is called directly |
|
| 148 | - * @param string $file |
|
| 149 | - * @return void |
|
| 150 | - */ |
|
| 151 | - public function actionInclude($file) { |
|
| 152 | - $function = function ($param) use ($file) { |
|
| 153 | - unset($param["_route"]); |
|
| 154 | - $_GET = array_merge($_GET, $param); |
|
| 155 | - unset($param); |
|
| 156 | - require_once "$file"; |
|
| 157 | - } ; |
|
| 158 | - $this->action($function); |
|
| 159 | - } |
|
| 145 | + /** |
|
| 146 | + * The action to execute when this route matches, includes a file like |
|
| 147 | + * it is called directly |
|
| 148 | + * @param string $file |
|
| 149 | + * @return void |
|
| 150 | + */ |
|
| 151 | + public function actionInclude($file) { |
|
| 152 | + $function = function ($param) use ($file) { |
|
| 153 | + unset($param["_route"]); |
|
| 154 | + $_GET = array_merge($_GET, $param); |
|
| 155 | + unset($param); |
|
| 156 | + require_once "$file"; |
|
| 157 | + } ; |
|
| 158 | + $this->action($function); |
|
| 159 | + } |
|
| 160 | 160 | } |
@@ -33,99 +33,99 @@ |
||
| 33 | 33 | use OCP\AppFramework\Http as BaseHttp; |
| 34 | 34 | |
| 35 | 35 | class Http extends BaseHttp { |
| 36 | - private $server; |
|
| 37 | - private $protocolVersion; |
|
| 38 | - protected $headers; |
|
| 36 | + private $server; |
|
| 37 | + private $protocolVersion; |
|
| 38 | + protected $headers; |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @param array $server $_SERVER |
|
| 42 | - * @param string $protocolVersion the http version to use defaults to HTTP/1.1 |
|
| 43 | - */ |
|
| 44 | - public function __construct($server, $protocolVersion = 'HTTP/1.1') { |
|
| 45 | - $this->server = $server; |
|
| 46 | - $this->protocolVersion = $protocolVersion; |
|
| 40 | + /** |
|
| 41 | + * @param array $server $_SERVER |
|
| 42 | + * @param string $protocolVersion the http version to use defaults to HTTP/1.1 |
|
| 43 | + */ |
|
| 44 | + public function __construct($server, $protocolVersion = 'HTTP/1.1') { |
|
| 45 | + $this->server = $server; |
|
| 46 | + $this->protocolVersion = $protocolVersion; |
|
| 47 | 47 | |
| 48 | - $this->headers = [ |
|
| 49 | - self::STATUS_CONTINUE => 'Continue', |
|
| 50 | - self::STATUS_SWITCHING_PROTOCOLS => 'Switching Protocols', |
|
| 51 | - self::STATUS_PROCESSING => 'Processing', |
|
| 52 | - self::STATUS_OK => 'OK', |
|
| 53 | - self::STATUS_CREATED => 'Created', |
|
| 54 | - self::STATUS_ACCEPTED => 'Accepted', |
|
| 55 | - self::STATUS_NON_AUTHORATIVE_INFORMATION => 'Non-Authorative Information', |
|
| 56 | - self::STATUS_NO_CONTENT => 'No Content', |
|
| 57 | - self::STATUS_RESET_CONTENT => 'Reset Content', |
|
| 58 | - self::STATUS_PARTIAL_CONTENT => 'Partial Content', |
|
| 59 | - self::STATUS_MULTI_STATUS => 'Multi-Status', // RFC 4918 |
|
| 60 | - self::STATUS_ALREADY_REPORTED => 'Already Reported', // RFC 5842 |
|
| 61 | - self::STATUS_IM_USED => 'IM Used', // RFC 3229 |
|
| 62 | - self::STATUS_MULTIPLE_CHOICES => 'Multiple Choices', |
|
| 63 | - self::STATUS_MOVED_PERMANENTLY => 'Moved Permanently', |
|
| 64 | - self::STATUS_FOUND => 'Found', |
|
| 65 | - self::STATUS_SEE_OTHER => 'See Other', |
|
| 66 | - self::STATUS_NOT_MODIFIED => 'Not Modified', |
|
| 67 | - self::STATUS_USE_PROXY => 'Use Proxy', |
|
| 68 | - self::STATUS_RESERVED => 'Reserved', |
|
| 69 | - self::STATUS_TEMPORARY_REDIRECT => 'Temporary Redirect', |
|
| 70 | - self::STATUS_BAD_REQUEST => 'Bad request', |
|
| 71 | - self::STATUS_UNAUTHORIZED => 'Unauthorized', |
|
| 72 | - self::STATUS_PAYMENT_REQUIRED => 'Payment Required', |
|
| 73 | - self::STATUS_FORBIDDEN => 'Forbidden', |
|
| 74 | - self::STATUS_NOT_FOUND => 'Not Found', |
|
| 75 | - self::STATUS_METHOD_NOT_ALLOWED => 'Method Not Allowed', |
|
| 76 | - self::STATUS_NOT_ACCEPTABLE => 'Not Acceptable', |
|
| 77 | - self::STATUS_PROXY_AUTHENTICATION_REQUIRED => 'Proxy Authentication Required', |
|
| 78 | - self::STATUS_REQUEST_TIMEOUT => 'Request Timeout', |
|
| 79 | - self::STATUS_CONFLICT => 'Conflict', |
|
| 80 | - self::STATUS_GONE => 'Gone', |
|
| 81 | - self::STATUS_LENGTH_REQUIRED => 'Length Required', |
|
| 82 | - self::STATUS_PRECONDITION_FAILED => 'Precondition failed', |
|
| 83 | - self::STATUS_REQUEST_ENTITY_TOO_LARGE => 'Request Entity Too Large', |
|
| 84 | - self::STATUS_REQUEST_URI_TOO_LONG => 'Request-URI Too Long', |
|
| 85 | - self::STATUS_UNSUPPORTED_MEDIA_TYPE => 'Unsupported Media Type', |
|
| 86 | - self::STATUS_REQUEST_RANGE_NOT_SATISFIABLE => 'Requested Range Not Satisfiable', |
|
| 87 | - self::STATUS_EXPECTATION_FAILED => 'Expectation Failed', |
|
| 88 | - self::STATUS_IM_A_TEAPOT => 'I\'m a teapot', // RFC 2324 |
|
| 89 | - self::STATUS_UNPROCESSABLE_ENTITY => 'Unprocessable Entity', // RFC 4918 |
|
| 90 | - self::STATUS_LOCKED => 'Locked', // RFC 4918 |
|
| 91 | - self::STATUS_FAILED_DEPENDENCY => 'Failed Dependency', // RFC 4918 |
|
| 92 | - self::STATUS_UPGRADE_REQUIRED => 'Upgrade required', |
|
| 93 | - self::STATUS_PRECONDITION_REQUIRED => 'Precondition required', // draft-nottingham-http-new-status |
|
| 94 | - self::STATUS_TOO_MANY_REQUESTS => 'Too Many Requests', // draft-nottingham-http-new-status |
|
| 95 | - self::STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE => 'Request Header Fields Too Large', // draft-nottingham-http-new-status |
|
| 96 | - self::STATUS_INTERNAL_SERVER_ERROR => 'Internal Server Error', |
|
| 97 | - self::STATUS_NOT_IMPLEMENTED => 'Not Implemented', |
|
| 98 | - self::STATUS_BAD_GATEWAY => 'Bad Gateway', |
|
| 99 | - self::STATUS_SERVICE_UNAVAILABLE => 'Service Unavailable', |
|
| 100 | - self::STATUS_GATEWAY_TIMEOUT => 'Gateway Timeout', |
|
| 101 | - self::STATUS_HTTP_VERSION_NOT_SUPPORTED => 'HTTP Version not supported', |
|
| 102 | - self::STATUS_VARIANT_ALSO_NEGOTIATES => 'Variant Also Negotiates', |
|
| 103 | - self::STATUS_INSUFFICIENT_STORAGE => 'Insufficient Storage', // RFC 4918 |
|
| 104 | - self::STATUS_LOOP_DETECTED => 'Loop Detected', // RFC 5842 |
|
| 105 | - self::STATUS_BANDWIDTH_LIMIT_EXCEEDED => 'Bandwidth Limit Exceeded', // non-standard |
|
| 106 | - self::STATUS_NOT_EXTENDED => 'Not extended', |
|
| 107 | - self::STATUS_NETWORK_AUTHENTICATION_REQUIRED => 'Network Authentication Required', // draft-nottingham-http-new-status |
|
| 108 | - ]; |
|
| 109 | - } |
|
| 48 | + $this->headers = [ |
|
| 49 | + self::STATUS_CONTINUE => 'Continue', |
|
| 50 | + self::STATUS_SWITCHING_PROTOCOLS => 'Switching Protocols', |
|
| 51 | + self::STATUS_PROCESSING => 'Processing', |
|
| 52 | + self::STATUS_OK => 'OK', |
|
| 53 | + self::STATUS_CREATED => 'Created', |
|
| 54 | + self::STATUS_ACCEPTED => 'Accepted', |
|
| 55 | + self::STATUS_NON_AUTHORATIVE_INFORMATION => 'Non-Authorative Information', |
|
| 56 | + self::STATUS_NO_CONTENT => 'No Content', |
|
| 57 | + self::STATUS_RESET_CONTENT => 'Reset Content', |
|
| 58 | + self::STATUS_PARTIAL_CONTENT => 'Partial Content', |
|
| 59 | + self::STATUS_MULTI_STATUS => 'Multi-Status', // RFC 4918 |
|
| 60 | + self::STATUS_ALREADY_REPORTED => 'Already Reported', // RFC 5842 |
|
| 61 | + self::STATUS_IM_USED => 'IM Used', // RFC 3229 |
|
| 62 | + self::STATUS_MULTIPLE_CHOICES => 'Multiple Choices', |
|
| 63 | + self::STATUS_MOVED_PERMANENTLY => 'Moved Permanently', |
|
| 64 | + self::STATUS_FOUND => 'Found', |
|
| 65 | + self::STATUS_SEE_OTHER => 'See Other', |
|
| 66 | + self::STATUS_NOT_MODIFIED => 'Not Modified', |
|
| 67 | + self::STATUS_USE_PROXY => 'Use Proxy', |
|
| 68 | + self::STATUS_RESERVED => 'Reserved', |
|
| 69 | + self::STATUS_TEMPORARY_REDIRECT => 'Temporary Redirect', |
|
| 70 | + self::STATUS_BAD_REQUEST => 'Bad request', |
|
| 71 | + self::STATUS_UNAUTHORIZED => 'Unauthorized', |
|
| 72 | + self::STATUS_PAYMENT_REQUIRED => 'Payment Required', |
|
| 73 | + self::STATUS_FORBIDDEN => 'Forbidden', |
|
| 74 | + self::STATUS_NOT_FOUND => 'Not Found', |
|
| 75 | + self::STATUS_METHOD_NOT_ALLOWED => 'Method Not Allowed', |
|
| 76 | + self::STATUS_NOT_ACCEPTABLE => 'Not Acceptable', |
|
| 77 | + self::STATUS_PROXY_AUTHENTICATION_REQUIRED => 'Proxy Authentication Required', |
|
| 78 | + self::STATUS_REQUEST_TIMEOUT => 'Request Timeout', |
|
| 79 | + self::STATUS_CONFLICT => 'Conflict', |
|
| 80 | + self::STATUS_GONE => 'Gone', |
|
| 81 | + self::STATUS_LENGTH_REQUIRED => 'Length Required', |
|
| 82 | + self::STATUS_PRECONDITION_FAILED => 'Precondition failed', |
|
| 83 | + self::STATUS_REQUEST_ENTITY_TOO_LARGE => 'Request Entity Too Large', |
|
| 84 | + self::STATUS_REQUEST_URI_TOO_LONG => 'Request-URI Too Long', |
|
| 85 | + self::STATUS_UNSUPPORTED_MEDIA_TYPE => 'Unsupported Media Type', |
|
| 86 | + self::STATUS_REQUEST_RANGE_NOT_SATISFIABLE => 'Requested Range Not Satisfiable', |
|
| 87 | + self::STATUS_EXPECTATION_FAILED => 'Expectation Failed', |
|
| 88 | + self::STATUS_IM_A_TEAPOT => 'I\'m a teapot', // RFC 2324 |
|
| 89 | + self::STATUS_UNPROCESSABLE_ENTITY => 'Unprocessable Entity', // RFC 4918 |
|
| 90 | + self::STATUS_LOCKED => 'Locked', // RFC 4918 |
|
| 91 | + self::STATUS_FAILED_DEPENDENCY => 'Failed Dependency', // RFC 4918 |
|
| 92 | + self::STATUS_UPGRADE_REQUIRED => 'Upgrade required', |
|
| 93 | + self::STATUS_PRECONDITION_REQUIRED => 'Precondition required', // draft-nottingham-http-new-status |
|
| 94 | + self::STATUS_TOO_MANY_REQUESTS => 'Too Many Requests', // draft-nottingham-http-new-status |
|
| 95 | + self::STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE => 'Request Header Fields Too Large', // draft-nottingham-http-new-status |
|
| 96 | + self::STATUS_INTERNAL_SERVER_ERROR => 'Internal Server Error', |
|
| 97 | + self::STATUS_NOT_IMPLEMENTED => 'Not Implemented', |
|
| 98 | + self::STATUS_BAD_GATEWAY => 'Bad Gateway', |
|
| 99 | + self::STATUS_SERVICE_UNAVAILABLE => 'Service Unavailable', |
|
| 100 | + self::STATUS_GATEWAY_TIMEOUT => 'Gateway Timeout', |
|
| 101 | + self::STATUS_HTTP_VERSION_NOT_SUPPORTED => 'HTTP Version not supported', |
|
| 102 | + self::STATUS_VARIANT_ALSO_NEGOTIATES => 'Variant Also Negotiates', |
|
| 103 | + self::STATUS_INSUFFICIENT_STORAGE => 'Insufficient Storage', // RFC 4918 |
|
| 104 | + self::STATUS_LOOP_DETECTED => 'Loop Detected', // RFC 5842 |
|
| 105 | + self::STATUS_BANDWIDTH_LIMIT_EXCEEDED => 'Bandwidth Limit Exceeded', // non-standard |
|
| 106 | + self::STATUS_NOT_EXTENDED => 'Not extended', |
|
| 107 | + self::STATUS_NETWORK_AUTHENTICATION_REQUIRED => 'Network Authentication Required', // draft-nottingham-http-new-status |
|
| 108 | + ]; |
|
| 109 | + } |
|
| 110 | 110 | |
| 111 | 111 | |
| 112 | - /** |
|
| 113 | - * Gets the correct header |
|
| 114 | - * @param int Http::CONSTANT $status the constant from the Http class |
|
| 115 | - * @param \DateTime $lastModified formatted last modified date |
|
| 116 | - * @param string $ETag the etag |
|
| 117 | - * @return string |
|
| 118 | - */ |
|
| 119 | - public function getStatusHeader($status) { |
|
| 120 | - // we have one change currently for the http 1.0 header that differs |
|
| 121 | - // from 1.1: STATUS_TEMPORARY_REDIRECT should be STATUS_FOUND |
|
| 122 | - // if this differs any more, we want to create childclasses for this |
|
| 123 | - if ($status === self::STATUS_TEMPORARY_REDIRECT |
|
| 124 | - && $this->protocolVersion === 'HTTP/1.0') { |
|
| 125 | - $status = self::STATUS_FOUND; |
|
| 126 | - } |
|
| 112 | + /** |
|
| 113 | + * Gets the correct header |
|
| 114 | + * @param int Http::CONSTANT $status the constant from the Http class |
|
| 115 | + * @param \DateTime $lastModified formatted last modified date |
|
| 116 | + * @param string $ETag the etag |
|
| 117 | + * @return string |
|
| 118 | + */ |
|
| 119 | + public function getStatusHeader($status) { |
|
| 120 | + // we have one change currently for the http 1.0 header that differs |
|
| 121 | + // from 1.1: STATUS_TEMPORARY_REDIRECT should be STATUS_FOUND |
|
| 122 | + // if this differs any more, we want to create childclasses for this |
|
| 123 | + if ($status === self::STATUS_TEMPORARY_REDIRECT |
|
| 124 | + && $this->protocolVersion === 'HTTP/1.0') { |
|
| 125 | + $status = self::STATUS_FOUND; |
|
| 126 | + } |
|
| 127 | 127 | |
| 128 | - return $this->protocolVersion . ' ' . $status . ' ' . |
|
| 129 | - $this->headers[$status]; |
|
| 130 | - } |
|
| 128 | + return $this->protocolVersion . ' ' . $status . ' ' . |
|
| 129 | + $this->headers[$status]; |
|
| 130 | + } |
|
| 131 | 131 | } |
@@ -29,54 +29,54 @@ |
||
| 29 | 29 | use OCP\IServerContainer; |
| 30 | 30 | |
| 31 | 31 | class Manager implements IManager { |
| 32 | - /** @var string[] */ |
|
| 33 | - protected $sorters = []; |
|
| 32 | + /** @var string[] */ |
|
| 33 | + protected $sorters = []; |
|
| 34 | 34 | |
| 35 | - /** @var ISorter[] */ |
|
| 36 | - protected $sorterInstances = []; |
|
| 37 | - /** @var IServerContainer */ |
|
| 38 | - private $c; |
|
| 35 | + /** @var ISorter[] */ |
|
| 36 | + protected $sorterInstances = []; |
|
| 37 | + /** @var IServerContainer */ |
|
| 38 | + private $c; |
|
| 39 | 39 | |
| 40 | - public function __construct(IServerContainer $container) { |
|
| 41 | - $this->c = $container; |
|
| 42 | - } |
|
| 40 | + public function __construct(IServerContainer $container) { |
|
| 41 | + $this->c = $container; |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - public function runSorters(array $sorters, array &$sortArray, array $context) { |
|
| 45 | - $sorterInstances = $this->getSorters(); |
|
| 46 | - while ($sorter = array_shift($sorters)) { |
|
| 47 | - if (isset($sorterInstances[$sorter])) { |
|
| 48 | - $sorterInstances[$sorter]->sort($sortArray, $context); |
|
| 49 | - } else { |
|
| 50 | - $this->c->getLogger()->warning('No sorter for ID "{id}", skipping', [ |
|
| 51 | - 'app' => 'core', 'id' => $sorter |
|
| 52 | - ]); |
|
| 53 | - } |
|
| 54 | - } |
|
| 55 | - } |
|
| 44 | + public function runSorters(array $sorters, array &$sortArray, array $context) { |
|
| 45 | + $sorterInstances = $this->getSorters(); |
|
| 46 | + while ($sorter = array_shift($sorters)) { |
|
| 47 | + if (isset($sorterInstances[$sorter])) { |
|
| 48 | + $sorterInstances[$sorter]->sort($sortArray, $context); |
|
| 49 | + } else { |
|
| 50 | + $this->c->getLogger()->warning('No sorter for ID "{id}", skipping', [ |
|
| 51 | + 'app' => 'core', 'id' => $sorter |
|
| 52 | + ]); |
|
| 53 | + } |
|
| 54 | + } |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - public function registerSorter($className) { |
|
| 58 | - $this->sorters[] = $className; |
|
| 59 | - } |
|
| 57 | + public function registerSorter($className) { |
|
| 58 | + $this->sorters[] = $className; |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - protected function getSorters() { |
|
| 62 | - if (count($this->sorterInstances) === 0) { |
|
| 63 | - foreach ($this->sorters as $sorter) { |
|
| 64 | - /** @var ISorter $instance */ |
|
| 65 | - $instance = $this->c->resolve($sorter); |
|
| 66 | - if (!$instance instanceof ISorter) { |
|
| 67 | - $this->c->getLogger()->notice('Skipping sorter which is not an instance of ISorter. Class name: {class}', |
|
| 68 | - ['app' => 'core', 'class' => $sorter]); |
|
| 69 | - continue; |
|
| 70 | - } |
|
| 71 | - $sorterId = trim($instance->getId()); |
|
| 72 | - if (trim($sorterId) === '') { |
|
| 73 | - $this->c->getLogger()->notice('Skipping sorter with empty ID. Class name: {class}', |
|
| 74 | - ['app' => 'core', 'class' => $sorter]); |
|
| 75 | - continue; |
|
| 76 | - } |
|
| 77 | - $this->sorterInstances[$sorterId] = $instance; |
|
| 78 | - } |
|
| 79 | - } |
|
| 80 | - return $this->sorterInstances; |
|
| 81 | - } |
|
| 61 | + protected function getSorters() { |
|
| 62 | + if (count($this->sorterInstances) === 0) { |
|
| 63 | + foreach ($this->sorters as $sorter) { |
|
| 64 | + /** @var ISorter $instance */ |
|
| 65 | + $instance = $this->c->resolve($sorter); |
|
| 66 | + if (!$instance instanceof ISorter) { |
|
| 67 | + $this->c->getLogger()->notice('Skipping sorter which is not an instance of ISorter. Class name: {class}', |
|
| 68 | + ['app' => 'core', 'class' => $sorter]); |
|
| 69 | + continue; |
|
| 70 | + } |
|
| 71 | + $sorterId = trim($instance->getId()); |
|
| 72 | + if (trim($sorterId) === '') { |
|
| 73 | + $this->c->getLogger()->notice('Skipping sorter with empty ID. Class name: {class}', |
|
| 74 | + ['app' => 'core', 'class' => $sorter]); |
|
| 75 | + continue; |
|
| 76 | + } |
|
| 77 | + $this->sorterInstances[$sorterId] = $instance; |
|
| 78 | + } |
|
| 79 | + } |
|
| 80 | + return $this->sorterInstances; |
|
| 81 | + } |
|
| 82 | 82 | } |
@@ -30,13 +30,13 @@ |
||
| 30 | 30 | * @since 14.0.0 |
| 31 | 31 | */ |
| 32 | 32 | interface IFileBased { |
| 33 | - /** |
|
| 34 | - * @since 14.0.0 |
|
| 35 | - */ |
|
| 36 | - public function getLogFilePath():string; |
|
| 33 | + /** |
|
| 34 | + * @since 14.0.0 |
|
| 35 | + */ |
|
| 36 | + public function getLogFilePath():string; |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * @since 14.0.0 |
|
| 40 | - */ |
|
| 41 | - public function getEntries(int $limit = 50, int $offset = 0): array; |
|
| 38 | + /** |
|
| 39 | + * @since 14.0.0 |
|
| 40 | + */ |
|
| 41 | + public function getEntries(int $limit = 50, int $offset = 0): array; |
|
| 42 | 42 | } |