@@ -16,8 +16,11 @@ |
||
| 16 | 16 | <?php if ($error): ?> |
| 17 | 17 | <?php if($error_message): ?> |
| 18 | 18 | <p><strong><?php p($error_message); ?></strong></p> |
| 19 | - <?php else: ?> |
|
| 20 | - <p><strong><?php p($l->t('Error while validating your second factor')); ?></strong></p> |
|
| 19 | + <?php else { |
|
| 20 | + : ?> |
|
| 21 | + <p><strong><?php p($l->t('Error while validating your second factor')); |
|
| 22 | +} |
|
| 23 | +?></strong></p> |
|
| 21 | 24 | <?php endif; ?> |
| 22 | 25 | <?php endif; ?> |
| 23 | 26 | <?php print_unescaped($template); ?> |
@@ -24,11 +24,11 @@ |
||
| 24 | 24 | <?php if (!is_null($_['backupProvider'])): ?> |
| 25 | 25 | <p> |
| 26 | 26 | <a class="two-factor-secondary" href="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.showChallenge', |
| 27 | - [ |
|
| 28 | - 'challengeProviderId' => $_['backupProvider']->getId(), |
|
| 29 | - 'redirect_url' => $_['redirect_url'], |
|
| 30 | - ] |
|
| 31 | - )) ?>"> |
|
| 27 | + [ |
|
| 28 | + 'challengeProviderId' => $_['backupProvider']->getId(), |
|
| 29 | + 'redirect_url' => $_['redirect_url'], |
|
| 30 | + ] |
|
| 31 | + )) ?>"> |
|
| 32 | 32 | <?php p($l->t('Use backup code')) ?> |
| 33 | 33 | </a> |
| 34 | 34 | </p> |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | <div class="body-login-container update"> |
| 15 | 15 | <h2 class="two-factor-header"><?php p($provider->getDisplayName()); ?></h2> |
| 16 | 16 | <?php if ($error): ?> |
| 17 | - <?php if($error_message): ?> |
|
| 17 | + <?php if ($error_message): ?> |
|
| 18 | 18 | <p><strong><?php p($error_message); ?></strong></p> |
| 19 | 19 | <?php else: ?> |
| 20 | 20 | <p><strong><?php p($l->t('Error while validating your second factor')); ?></strong></p> |
@@ -88,7 +88,7 @@ |
||
| 88 | 88 | if (strpos($path, '/webdav/') === 0) { |
| 89 | 89 | $path = substr($path, strlen('/webdav')); |
| 90 | 90 | } |
| 91 | - $path = $this->path . $path; |
|
| 91 | + $path = $this->path.$path; |
|
| 92 | 92 | $this->mimeType[$this->storage->getId()][$path] = $this->mimeTypeDetector->detectPath($path); |
| 93 | 93 | return $this->mimeType[$this->storage->getId()][$path]; |
| 94 | 94 | } |
@@ -29,170 +29,170 @@ |
||
| 29 | 29 | |
| 30 | 30 | class FileMimeType extends AbstractStringCheck { |
| 31 | 31 | |
| 32 | - /** @var array */ |
|
| 33 | - protected $mimeType; |
|
| 34 | - |
|
| 35 | - /** @var IRequest */ |
|
| 36 | - protected $request; |
|
| 37 | - |
|
| 38 | - /** @var IMimeTypeDetector */ |
|
| 39 | - protected $mimeTypeDetector; |
|
| 40 | - |
|
| 41 | - /** @var IStorage */ |
|
| 42 | - protected $storage; |
|
| 43 | - |
|
| 44 | - /** @var string */ |
|
| 45 | - protected $path; |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * @param IL10N $l |
|
| 49 | - * @param IRequest $request |
|
| 50 | - * @param IMimeTypeDetector $mimeTypeDetector |
|
| 51 | - */ |
|
| 52 | - public function __construct(IL10N $l, IRequest $request, IMimeTypeDetector $mimeTypeDetector) { |
|
| 53 | - parent::__construct($l); |
|
| 54 | - $this->request = $request; |
|
| 55 | - $this->mimeTypeDetector = $mimeTypeDetector; |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - /** |
|
| 59 | - * @param IStorage $storage |
|
| 60 | - * @param string $path |
|
| 61 | - */ |
|
| 62 | - public function setFileInfo(IStorage $storage, $path) { |
|
| 63 | - $this->storage = $storage; |
|
| 64 | - $this->path = $path; |
|
| 65 | - if (!isset($this->mimeType[$this->storage->getId()][$this->path]) |
|
| 66 | - || $this->mimeType[$this->storage->getId()][$this->path] === '') { |
|
| 67 | - $this->mimeType[$this->storage->getId()][$this->path] = null; |
|
| 68 | - } |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - /** |
|
| 72 | - * @return string |
|
| 73 | - */ |
|
| 74 | - protected function getActualValue() { |
|
| 75 | - if ($this->mimeType[$this->storage->getId()][$this->path] !== null) { |
|
| 76 | - return $this->mimeType[$this->storage->getId()][$this->path]; |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - if ($this->storage->is_dir($this->path)) { |
|
| 80 | - $this->mimeType[$this->storage->getId()][$this->path] = 'httpd/unix-directory'; |
|
| 81 | - return $this->mimeType[$this->storage->getId()][$this->path]; |
|
| 82 | - } |
|
| 83 | - |
|
| 84 | - if ($this->isWebDAVRequest()) { |
|
| 85 | - // Creating a folder |
|
| 86 | - if ($this->request->getMethod() === 'MKCOL') { |
|
| 87 | - $this->mimeType[$this->storage->getId()][$this->path] = 'httpd/unix-directory'; |
|
| 88 | - return $this->mimeType[$this->storage->getId()][$this->path]; |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - if ($this->request->getMethod() === 'PUT' || $this->request->getMethod() === 'MOVE') { |
|
| 92 | - if ($this->request->getMethod() === 'MOVE') { |
|
| 93 | - $this->mimeType[$this->storage->getId()][$this->path] = $this->mimeTypeDetector->detectPath($this->path); |
|
| 94 | - } else { |
|
| 95 | - $path = $this->request->getPathInfo(); |
|
| 96 | - $this->mimeType[$this->storage->getId()][$this->path] = $this->mimeTypeDetector->detectPath($path); |
|
| 97 | - } |
|
| 98 | - return $this->mimeType[$this->storage->getId()][$this->path]; |
|
| 99 | - } |
|
| 100 | - } else if ($this->isPublicWebDAVRequest()) { |
|
| 101 | - if ($this->request->getMethod() === 'PUT') { |
|
| 102 | - $path = $this->request->getPathInfo(); |
|
| 103 | - if (strpos($path, '/webdav/') === 0) { |
|
| 104 | - $path = substr($path, strlen('/webdav')); |
|
| 105 | - } |
|
| 106 | - $path = $this->path . $path; |
|
| 107 | - $this->mimeType[$this->storage->getId()][$path] = $this->mimeTypeDetector->detectPath($path); |
|
| 108 | - return $this->mimeType[$this->storage->getId()][$path]; |
|
| 109 | - } |
|
| 110 | - } |
|
| 111 | - |
|
| 112 | - if (in_array($this->request->getMethod(), ['POST', 'PUT'])) { |
|
| 113 | - $files = $this->request->getUploadedFile('files'); |
|
| 114 | - if (isset($files['type'][0])) { |
|
| 115 | - $mimeType = $files['type'][0]; |
|
| 116 | - if ($this->mimeType === 'application/octet-stream') { |
|
| 117 | - // Maybe not... |
|
| 118 | - $mimeTypeTest = $this->mimeTypeDetector->detectPath($files['name'][0]); |
|
| 119 | - if ($mimeTypeTest !== 'application/octet-stream' && $mimeTypeTest !== false) { |
|
| 120 | - $mimeType = $mimeTypeTest; |
|
| 121 | - } else { |
|
| 122 | - $mimeTypeTest = $this->mimeTypeDetector->detect($files['tmp_name'][0]); |
|
| 123 | - if ($mimeTypeTest !== 'application/octet-stream' && $mimeTypeTest !== false) { |
|
| 124 | - $mimeType = $mimeTypeTest; |
|
| 125 | - } |
|
| 126 | - } |
|
| 127 | - } |
|
| 128 | - $this->mimeType[$this->storage->getId()][$this->path] = $mimeType; |
|
| 129 | - return $mimeType; |
|
| 130 | - } |
|
| 131 | - } |
|
| 132 | - |
|
| 133 | - $this->mimeType[$this->storage->getId()][$this->path] = $this->storage->getMimeType($this->path); |
|
| 134 | - if ($this->mimeType[$this->storage->getId()][$this->path] === 'application/octet-stream') { |
|
| 135 | - $this->mimeType[$this->storage->getId()][$this->path] = $this->detectMimetypeFromPath(); |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - return $this->mimeType[$this->storage->getId()][$this->path]; |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - /** |
|
| 142 | - * @return string |
|
| 143 | - */ |
|
| 144 | - protected function detectMimetypeFromPath() { |
|
| 145 | - $mimeType = $this->mimeTypeDetector->detectPath($this->path); |
|
| 146 | - if ($mimeType !== 'application/octet-stream' && $mimeType !== false) { |
|
| 147 | - return $mimeType; |
|
| 148 | - } |
|
| 149 | - |
|
| 150 | - if ($this->storage->instanceOfStorage('\OC\Files\Storage\Local') |
|
| 151 | - || $this->storage->instanceOfStorage('\OC\Files\Storage\Home') |
|
| 152 | - || $this->storage->instanceOfStorage('\OC\Files\ObjectStore\HomeObjectStoreStorage')) { |
|
| 153 | - $localFile = $this->storage->getLocalFile($this->path); |
|
| 154 | - if ($localFile !== false) { |
|
| 155 | - $mimeType = $this->mimeTypeDetector->detect($localFile); |
|
| 156 | - if ($mimeType !== false) { |
|
| 157 | - return $mimeType; |
|
| 158 | - } |
|
| 159 | - } |
|
| 160 | - |
|
| 161 | - return 'application/octet-stream'; |
|
| 162 | - } else { |
|
| 163 | - $handle = $this->storage->fopen($this->path, 'r'); |
|
| 164 | - $data = fread($handle, 8024); |
|
| 165 | - fclose($handle); |
|
| 166 | - $mimeType = $this->mimeTypeDetector->detectString($data); |
|
| 167 | - if ($mimeType !== false) { |
|
| 168 | - return $mimeType; |
|
| 169 | - } |
|
| 170 | - |
|
| 171 | - return 'application/octet-stream'; |
|
| 172 | - } |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - /** |
|
| 176 | - * @return bool |
|
| 177 | - */ |
|
| 178 | - protected function isWebDAVRequest() { |
|
| 179 | - return substr($this->request->getScriptName(), 0 - strlen('/remote.php')) === '/remote.php' && ( |
|
| 180 | - $this->request->getPathInfo() === '/webdav' || |
|
| 181 | - strpos($this->request->getPathInfo(), '/webdav/') === 0 || |
|
| 182 | - $this->request->getPathInfo() === '/dav/files' || |
|
| 183 | - strpos($this->request->getPathInfo(), '/dav/files/') === 0 || |
|
| 184 | - $this->request->getPathInfo() === '/dav/uploads' || |
|
| 185 | - strpos($this->request->getPathInfo(), '/dav/uploads/') === 0 |
|
| 186 | - ); |
|
| 187 | - } |
|
| 188 | - |
|
| 189 | - /** |
|
| 190 | - * @return bool |
|
| 191 | - */ |
|
| 192 | - protected function isPublicWebDAVRequest() { |
|
| 193 | - return substr($this->request->getScriptName(), 0 - strlen('/public.php')) === '/public.php' && ( |
|
| 194 | - $this->request->getPathInfo() === '/webdav' || |
|
| 195 | - strpos($this->request->getPathInfo(), '/webdav/') === 0 |
|
| 196 | - ); |
|
| 197 | - } |
|
| 32 | + /** @var array */ |
|
| 33 | + protected $mimeType; |
|
| 34 | + |
|
| 35 | + /** @var IRequest */ |
|
| 36 | + protected $request; |
|
| 37 | + |
|
| 38 | + /** @var IMimeTypeDetector */ |
|
| 39 | + protected $mimeTypeDetector; |
|
| 40 | + |
|
| 41 | + /** @var IStorage */ |
|
| 42 | + protected $storage; |
|
| 43 | + |
|
| 44 | + /** @var string */ |
|
| 45 | + protected $path; |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * @param IL10N $l |
|
| 49 | + * @param IRequest $request |
|
| 50 | + * @param IMimeTypeDetector $mimeTypeDetector |
|
| 51 | + */ |
|
| 52 | + public function __construct(IL10N $l, IRequest $request, IMimeTypeDetector $mimeTypeDetector) { |
|
| 53 | + parent::__construct($l); |
|
| 54 | + $this->request = $request; |
|
| 55 | + $this->mimeTypeDetector = $mimeTypeDetector; |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + /** |
|
| 59 | + * @param IStorage $storage |
|
| 60 | + * @param string $path |
|
| 61 | + */ |
|
| 62 | + public function setFileInfo(IStorage $storage, $path) { |
|
| 63 | + $this->storage = $storage; |
|
| 64 | + $this->path = $path; |
|
| 65 | + if (!isset($this->mimeType[$this->storage->getId()][$this->path]) |
|
| 66 | + || $this->mimeType[$this->storage->getId()][$this->path] === '') { |
|
| 67 | + $this->mimeType[$this->storage->getId()][$this->path] = null; |
|
| 68 | + } |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + /** |
|
| 72 | + * @return string |
|
| 73 | + */ |
|
| 74 | + protected function getActualValue() { |
|
| 75 | + if ($this->mimeType[$this->storage->getId()][$this->path] !== null) { |
|
| 76 | + return $this->mimeType[$this->storage->getId()][$this->path]; |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + if ($this->storage->is_dir($this->path)) { |
|
| 80 | + $this->mimeType[$this->storage->getId()][$this->path] = 'httpd/unix-directory'; |
|
| 81 | + return $this->mimeType[$this->storage->getId()][$this->path]; |
|
| 82 | + } |
|
| 83 | + |
|
| 84 | + if ($this->isWebDAVRequest()) { |
|
| 85 | + // Creating a folder |
|
| 86 | + if ($this->request->getMethod() === 'MKCOL') { |
|
| 87 | + $this->mimeType[$this->storage->getId()][$this->path] = 'httpd/unix-directory'; |
|
| 88 | + return $this->mimeType[$this->storage->getId()][$this->path]; |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + if ($this->request->getMethod() === 'PUT' || $this->request->getMethod() === 'MOVE') { |
|
| 92 | + if ($this->request->getMethod() === 'MOVE') { |
|
| 93 | + $this->mimeType[$this->storage->getId()][$this->path] = $this->mimeTypeDetector->detectPath($this->path); |
|
| 94 | + } else { |
|
| 95 | + $path = $this->request->getPathInfo(); |
|
| 96 | + $this->mimeType[$this->storage->getId()][$this->path] = $this->mimeTypeDetector->detectPath($path); |
|
| 97 | + } |
|
| 98 | + return $this->mimeType[$this->storage->getId()][$this->path]; |
|
| 99 | + } |
|
| 100 | + } else if ($this->isPublicWebDAVRequest()) { |
|
| 101 | + if ($this->request->getMethod() === 'PUT') { |
|
| 102 | + $path = $this->request->getPathInfo(); |
|
| 103 | + if (strpos($path, '/webdav/') === 0) { |
|
| 104 | + $path = substr($path, strlen('/webdav')); |
|
| 105 | + } |
|
| 106 | + $path = $this->path . $path; |
|
| 107 | + $this->mimeType[$this->storage->getId()][$path] = $this->mimeTypeDetector->detectPath($path); |
|
| 108 | + return $this->mimeType[$this->storage->getId()][$path]; |
|
| 109 | + } |
|
| 110 | + } |
|
| 111 | + |
|
| 112 | + if (in_array($this->request->getMethod(), ['POST', 'PUT'])) { |
|
| 113 | + $files = $this->request->getUploadedFile('files'); |
|
| 114 | + if (isset($files['type'][0])) { |
|
| 115 | + $mimeType = $files['type'][0]; |
|
| 116 | + if ($this->mimeType === 'application/octet-stream') { |
|
| 117 | + // Maybe not... |
|
| 118 | + $mimeTypeTest = $this->mimeTypeDetector->detectPath($files['name'][0]); |
|
| 119 | + if ($mimeTypeTest !== 'application/octet-stream' && $mimeTypeTest !== false) { |
|
| 120 | + $mimeType = $mimeTypeTest; |
|
| 121 | + } else { |
|
| 122 | + $mimeTypeTest = $this->mimeTypeDetector->detect($files['tmp_name'][0]); |
|
| 123 | + if ($mimeTypeTest !== 'application/octet-stream' && $mimeTypeTest !== false) { |
|
| 124 | + $mimeType = $mimeTypeTest; |
|
| 125 | + } |
|
| 126 | + } |
|
| 127 | + } |
|
| 128 | + $this->mimeType[$this->storage->getId()][$this->path] = $mimeType; |
|
| 129 | + return $mimeType; |
|
| 130 | + } |
|
| 131 | + } |
|
| 132 | + |
|
| 133 | + $this->mimeType[$this->storage->getId()][$this->path] = $this->storage->getMimeType($this->path); |
|
| 134 | + if ($this->mimeType[$this->storage->getId()][$this->path] === 'application/octet-stream') { |
|
| 135 | + $this->mimeType[$this->storage->getId()][$this->path] = $this->detectMimetypeFromPath(); |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + return $this->mimeType[$this->storage->getId()][$this->path]; |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + /** |
|
| 142 | + * @return string |
|
| 143 | + */ |
|
| 144 | + protected function detectMimetypeFromPath() { |
|
| 145 | + $mimeType = $this->mimeTypeDetector->detectPath($this->path); |
|
| 146 | + if ($mimeType !== 'application/octet-stream' && $mimeType !== false) { |
|
| 147 | + return $mimeType; |
|
| 148 | + } |
|
| 149 | + |
|
| 150 | + if ($this->storage->instanceOfStorage('\OC\Files\Storage\Local') |
|
| 151 | + || $this->storage->instanceOfStorage('\OC\Files\Storage\Home') |
|
| 152 | + || $this->storage->instanceOfStorage('\OC\Files\ObjectStore\HomeObjectStoreStorage')) { |
|
| 153 | + $localFile = $this->storage->getLocalFile($this->path); |
|
| 154 | + if ($localFile !== false) { |
|
| 155 | + $mimeType = $this->mimeTypeDetector->detect($localFile); |
|
| 156 | + if ($mimeType !== false) { |
|
| 157 | + return $mimeType; |
|
| 158 | + } |
|
| 159 | + } |
|
| 160 | + |
|
| 161 | + return 'application/octet-stream'; |
|
| 162 | + } else { |
|
| 163 | + $handle = $this->storage->fopen($this->path, 'r'); |
|
| 164 | + $data = fread($handle, 8024); |
|
| 165 | + fclose($handle); |
|
| 166 | + $mimeType = $this->mimeTypeDetector->detectString($data); |
|
| 167 | + if ($mimeType !== false) { |
|
| 168 | + return $mimeType; |
|
| 169 | + } |
|
| 170 | + |
|
| 171 | + return 'application/octet-stream'; |
|
| 172 | + } |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + /** |
|
| 176 | + * @return bool |
|
| 177 | + */ |
|
| 178 | + protected function isWebDAVRequest() { |
|
| 179 | + return substr($this->request->getScriptName(), 0 - strlen('/remote.php')) === '/remote.php' && ( |
|
| 180 | + $this->request->getPathInfo() === '/webdav' || |
|
| 181 | + strpos($this->request->getPathInfo(), '/webdav/') === 0 || |
|
| 182 | + $this->request->getPathInfo() === '/dav/files' || |
|
| 183 | + strpos($this->request->getPathInfo(), '/dav/files/') === 0 || |
|
| 184 | + $this->request->getPathInfo() === '/dav/uploads' || |
|
| 185 | + strpos($this->request->getPathInfo(), '/dav/uploads/') === 0 |
|
| 186 | + ); |
|
| 187 | + } |
|
| 188 | + |
|
| 189 | + /** |
|
| 190 | + * @return bool |
|
| 191 | + */ |
|
| 192 | + protected function isPublicWebDAVRequest() { |
|
| 193 | + return substr($this->request->getScriptName(), 0 - strlen('/public.php')) === '/public.php' && ( |
|
| 194 | + $this->request->getPathInfo() === '/webdav' || |
|
| 195 | + strpos($this->request->getPathInfo(), '/webdav/') === 0 |
|
| 196 | + ); |
|
| 197 | + } |
|
| 198 | 198 | } |
@@ -27,41 +27,41 @@ |
||
| 27 | 27 | * @since 12.0.0 |
| 28 | 28 | */ |
| 29 | 29 | interface ISearchQuery { |
| 30 | - /** |
|
| 31 | - * @return ISearchOperator |
|
| 32 | - * @since 12.0.0 |
|
| 33 | - */ |
|
| 34 | - public function getSearchOperation(); |
|
| 30 | + /** |
|
| 31 | + * @return ISearchOperator |
|
| 32 | + * @since 12.0.0 |
|
| 33 | + */ |
|
| 34 | + public function getSearchOperation(); |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * Get the maximum number of results to return |
|
| 38 | - * |
|
| 39 | - * @return integer |
|
| 40 | - * @since 12.0.0 |
|
| 41 | - */ |
|
| 42 | - public function getLimit(); |
|
| 36 | + /** |
|
| 37 | + * Get the maximum number of results to return |
|
| 38 | + * |
|
| 39 | + * @return integer |
|
| 40 | + * @since 12.0.0 |
|
| 41 | + */ |
|
| 42 | + public function getLimit(); |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Get the offset for returned results |
|
| 46 | - * |
|
| 47 | - * @return integer |
|
| 48 | - * @since 12.0.0 |
|
| 49 | - */ |
|
| 50 | - public function getOffset(); |
|
| 44 | + /** |
|
| 45 | + * Get the offset for returned results |
|
| 46 | + * |
|
| 47 | + * @return integer |
|
| 48 | + * @since 12.0.0 |
|
| 49 | + */ |
|
| 50 | + public function getOffset(); |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * The fields and directions to order by |
|
| 54 | - * |
|
| 55 | - * @return ISearchOrder[] |
|
| 56 | - * @since 12.0.0 |
|
| 57 | - */ |
|
| 58 | - public function getOrder(); |
|
| 52 | + /** |
|
| 53 | + * The fields and directions to order by |
|
| 54 | + * |
|
| 55 | + * @return ISearchOrder[] |
|
| 56 | + * @since 12.0.0 |
|
| 57 | + */ |
|
| 58 | + public function getOrder(); |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * The user that issued the search |
|
| 62 | - * |
|
| 63 | - * @return IUser |
|
| 64 | - * @since 12.0.0 |
|
| 65 | - */ |
|
| 66 | - public function getUser(); |
|
| 60 | + /** |
|
| 61 | + * The user that issued the search |
|
| 62 | + * |
|
| 63 | + * @return IUser |
|
| 64 | + * @since 12.0.0 |
|
| 65 | + */ |
|
| 66 | + public function getUser(); |
|
| 67 | 67 | } |
@@ -27,66 +27,66 @@ |
||
| 27 | 27 | use OCP\IUser; |
| 28 | 28 | |
| 29 | 29 | class SearchQuery implements ISearchQuery { |
| 30 | - /** @var ISearchOperator */ |
|
| 31 | - private $searchOperation; |
|
| 32 | - /** @var integer */ |
|
| 33 | - private $limit; |
|
| 34 | - /** @var integer */ |
|
| 35 | - private $offset; |
|
| 36 | - /** @var ISearchOrder[] */ |
|
| 37 | - private $order; |
|
| 38 | - /** @var IUser */ |
|
| 39 | - private $user; |
|
| 30 | + /** @var ISearchOperator */ |
|
| 31 | + private $searchOperation; |
|
| 32 | + /** @var integer */ |
|
| 33 | + private $limit; |
|
| 34 | + /** @var integer */ |
|
| 35 | + private $offset; |
|
| 36 | + /** @var ISearchOrder[] */ |
|
| 37 | + private $order; |
|
| 38 | + /** @var IUser */ |
|
| 39 | + private $user; |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * SearchQuery constructor. |
|
| 43 | - * |
|
| 44 | - * @param ISearchOperator $searchOperation |
|
| 45 | - * @param int $limit |
|
| 46 | - * @param int $offset |
|
| 47 | - * @param array $order |
|
| 48 | - * @param IUser $user |
|
| 49 | - */ |
|
| 50 | - public function __construct(ISearchOperator $searchOperation, $limit, $offset, array $order, IUser $user) { |
|
| 51 | - $this->searchOperation = $searchOperation; |
|
| 52 | - $this->limit = $limit; |
|
| 53 | - $this->offset = $offset; |
|
| 54 | - $this->order = $order; |
|
| 55 | - $this->user = $user; |
|
| 56 | - } |
|
| 41 | + /** |
|
| 42 | + * SearchQuery constructor. |
|
| 43 | + * |
|
| 44 | + * @param ISearchOperator $searchOperation |
|
| 45 | + * @param int $limit |
|
| 46 | + * @param int $offset |
|
| 47 | + * @param array $order |
|
| 48 | + * @param IUser $user |
|
| 49 | + */ |
|
| 50 | + public function __construct(ISearchOperator $searchOperation, $limit, $offset, array $order, IUser $user) { |
|
| 51 | + $this->searchOperation = $searchOperation; |
|
| 52 | + $this->limit = $limit; |
|
| 53 | + $this->offset = $offset; |
|
| 54 | + $this->order = $order; |
|
| 55 | + $this->user = $user; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * @return ISearchOperator |
|
| 60 | - */ |
|
| 61 | - public function getSearchOperation() { |
|
| 62 | - return $this->searchOperation; |
|
| 63 | - } |
|
| 58 | + /** |
|
| 59 | + * @return ISearchOperator |
|
| 60 | + */ |
|
| 61 | + public function getSearchOperation() { |
|
| 62 | + return $this->searchOperation; |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * @return int |
|
| 67 | - */ |
|
| 68 | - public function getLimit() { |
|
| 69 | - return $this->limit; |
|
| 70 | - } |
|
| 65 | + /** |
|
| 66 | + * @return int |
|
| 67 | + */ |
|
| 68 | + public function getLimit() { |
|
| 69 | + return $this->limit; |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * @return int |
|
| 74 | - */ |
|
| 75 | - public function getOffset() { |
|
| 76 | - return $this->offset; |
|
| 77 | - } |
|
| 72 | + /** |
|
| 73 | + * @return int |
|
| 74 | + */ |
|
| 75 | + public function getOffset() { |
|
| 76 | + return $this->offset; |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - /** |
|
| 80 | - * @return ISearchOrder[] |
|
| 81 | - */ |
|
| 82 | - public function getOrder() { |
|
| 83 | - return $this->order; |
|
| 84 | - } |
|
| 79 | + /** |
|
| 80 | + * @return ISearchOrder[] |
|
| 81 | + */ |
|
| 82 | + public function getOrder() { |
|
| 83 | + return $this->order; |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - /** |
|
| 87 | - * @return IUser |
|
| 88 | - */ |
|
| 89 | - public function getUser() { |
|
| 90 | - return $this->user; |
|
| 91 | - } |
|
| 86 | + /** |
|
| 87 | + * @return IUser |
|
| 88 | + */ |
|
| 89 | + public function getUser() { |
|
| 90 | + return $this->user; |
|
| 91 | + } |
|
| 92 | 92 | } |
@@ -29,38 +29,38 @@ |
||
| 29 | 29 | use ID3Parser\ID3Parser; |
| 30 | 30 | |
| 31 | 31 | class MP3 extends Provider { |
| 32 | - /** |
|
| 33 | - * {@inheritDoc} |
|
| 34 | - */ |
|
| 35 | - public function getMimeType() { |
|
| 36 | - return '/audio\/mpeg/'; |
|
| 37 | - } |
|
| 32 | + /** |
|
| 33 | + * {@inheritDoc} |
|
| 34 | + */ |
|
| 35 | + public function getMimeType() { |
|
| 36 | + return '/audio\/mpeg/'; |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * {@inheritDoc} |
|
| 41 | - */ |
|
| 42 | - public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { |
|
| 43 | - $getID3 = new ID3Parser(); |
|
| 39 | + /** |
|
| 40 | + * {@inheritDoc} |
|
| 41 | + */ |
|
| 42 | + public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { |
|
| 43 | + $getID3 = new ID3Parser(); |
|
| 44 | 44 | |
| 45 | - $tmpPath = $fileview->toTmpFile($path); |
|
| 46 | - $tags = $getID3->analyze($tmpPath); |
|
| 47 | - unlink($tmpPath); |
|
| 48 | - $picture = isset($tags['id3v2']['APIC'][0]['data']) ? $tags['id3v2']['APIC'][0]['data'] : null; |
|
| 49 | - if(is_null($picture) && isset($tags['id3v2']['PIC'][0]['data'])) { |
|
| 50 | - $picture = $tags['id3v2']['PIC'][0]['data']; |
|
| 51 | - } |
|
| 45 | + $tmpPath = $fileview->toTmpFile($path); |
|
| 46 | + $tags = $getID3->analyze($tmpPath); |
|
| 47 | + unlink($tmpPath); |
|
| 48 | + $picture = isset($tags['id3v2']['APIC'][0]['data']) ? $tags['id3v2']['APIC'][0]['data'] : null; |
|
| 49 | + if(is_null($picture) && isset($tags['id3v2']['PIC'][0]['data'])) { |
|
| 50 | + $picture = $tags['id3v2']['PIC'][0]['data']; |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - if(!is_null($picture)) { |
|
| 54 | - $image = new \OC_Image(); |
|
| 55 | - $image->loadFromData($picture); |
|
| 53 | + if(!is_null($picture)) { |
|
| 54 | + $image = new \OC_Image(); |
|
| 55 | + $image->loadFromData($picture); |
|
| 56 | 56 | |
| 57 | - if ($image->valid()) { |
|
| 58 | - $image->scaleDownToFit($maxX, $maxY); |
|
| 57 | + if ($image->valid()) { |
|
| 58 | + $image->scaleDownToFit($maxX, $maxY); |
|
| 59 | 59 | |
| 60 | - return $image; |
|
| 61 | - } |
|
| 62 | - } |
|
| 60 | + return $image; |
|
| 61 | + } |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - return false; |
|
| 65 | - } |
|
| 64 | + return false; |
|
| 65 | + } |
|
| 66 | 66 | } |
@@ -46,11 +46,11 @@ |
||
| 46 | 46 | $tags = $getID3->analyze($tmpPath); |
| 47 | 47 | unlink($tmpPath); |
| 48 | 48 | $picture = isset($tags['id3v2']['APIC'][0]['data']) ? $tags['id3v2']['APIC'][0]['data'] : null; |
| 49 | - if(is_null($picture) && isset($tags['id3v2']['PIC'][0]['data'])) { |
|
| 49 | + if (is_null($picture) && isset($tags['id3v2']['PIC'][0]['data'])) { |
|
| 50 | 50 | $picture = $tags['id3v2']['PIC'][0]['data']; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - if(!is_null($picture)) { |
|
| 53 | + if (!is_null($picture)) { |
|
| 54 | 54 | $image = new \OC_Image(); |
| 55 | 55 | $image->loadFromData($picture); |
| 56 | 56 | |
@@ -23,18 +23,18 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | |
| 25 | 25 | return [ |
| 26 | - 'routes' => [ |
|
| 27 | - ['name' => 'MountPublicLink#createFederatedShare', 'url' => '/createFederatedShare', 'verb' => 'POST'], |
|
| 28 | - ['name' => 'MountPublicLink#askForFederatedShare', 'url' => '/askForFederatedShare', 'verb' => 'POST'], |
|
| 29 | - ], |
|
| 30 | - 'ocs' => [ |
|
| 31 | - ['root' => '/cloud', 'name' => 'RequestHandler#createShare', 'url' => '/shares', 'verb' => 'POST'], |
|
| 32 | - ['root' => '/cloud', 'name' => 'RequestHandler#reShare', 'url' => '/shares/{id}/reshare', 'verb' => 'POST'], |
|
| 33 | - ['root' => '/cloud', 'name' => 'RequestHandler#updatePermissions', 'url' => '/shares/{id}/permissions', 'verb' => 'POST'], |
|
| 34 | - ['root' => '/cloud', 'name' => 'RequestHandler#acceptShare', 'url' => '/shares/{id}/accept', 'verb' => 'POST'], |
|
| 35 | - ['root' => '/cloud', 'name' => 'RequestHandler#declineShare', 'url' => '/shares/{id}/decline', 'verb' => 'POST'], |
|
| 36 | - ['root' => '/cloud', 'name' => 'RequestHandler#unshare', 'url' => '/shares/{id}/unshare', 'verb' => 'POST'], |
|
| 37 | - ['root' => '/cloud', 'name' => 'RequestHandler#revoke', 'url' => '/shares/{id}/revoke', 'verb' => 'POST'], |
|
| 38 | - ['root' => '/cloud', 'name' => 'RequestHandler#move', 'url' => '/shares/{id}/move', 'verb' => 'POST'], |
|
| 39 | - ], |
|
| 26 | + 'routes' => [ |
|
| 27 | + ['name' => 'MountPublicLink#createFederatedShare', 'url' => '/createFederatedShare', 'verb' => 'POST'], |
|
| 28 | + ['name' => 'MountPublicLink#askForFederatedShare', 'url' => '/askForFederatedShare', 'verb' => 'POST'], |
|
| 29 | + ], |
|
| 30 | + 'ocs' => [ |
|
| 31 | + ['root' => '/cloud', 'name' => 'RequestHandler#createShare', 'url' => '/shares', 'verb' => 'POST'], |
|
| 32 | + ['root' => '/cloud', 'name' => 'RequestHandler#reShare', 'url' => '/shares/{id}/reshare', 'verb' => 'POST'], |
|
| 33 | + ['root' => '/cloud', 'name' => 'RequestHandler#updatePermissions', 'url' => '/shares/{id}/permissions', 'verb' => 'POST'], |
|
| 34 | + ['root' => '/cloud', 'name' => 'RequestHandler#acceptShare', 'url' => '/shares/{id}/accept', 'verb' => 'POST'], |
|
| 35 | + ['root' => '/cloud', 'name' => 'RequestHandler#declineShare', 'url' => '/shares/{id}/decline', 'verb' => 'POST'], |
|
| 36 | + ['root' => '/cloud', 'name' => 'RequestHandler#unshare', 'url' => '/shares/{id}/unshare', 'verb' => 'POST'], |
|
| 37 | + ['root' => '/cloud', 'name' => 'RequestHandler#revoke', 'url' => '/shares/{id}/revoke', 'verb' => 'POST'], |
|
| 38 | + ['root' => '/cloud', 'name' => 'RequestHandler#move', 'url' => '/shares/{id}/move', 'verb' => 'POST'], |
|
| 39 | + ], |
|
| 40 | 40 | ]; |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | // no php execution timeout for webdav |
| 23 | 23 | if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) { |
| 24 | - @set_time_limit(0); |
|
| 24 | + @set_time_limit(0); |
|
| 25 | 25 | } |
| 26 | 26 | ignore_user_abort(true); |
| 27 | 27 | |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | if ($provider === null) { |
| 217 | - throw new ProviderException('No provider with id .' . $id . ' found.'); |
|
| 217 | + throw new ProviderException('No provider with id .'.$id.' found.'); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | return $provider; |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | |
| 243 | 243 | if ($provider === null) { |
| 244 | - throw new ProviderException('No share provider for share type ' . $shareType); |
|
| 244 | + throw new ProviderException('No share provider for share type '.$shareType); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | return $provider; |
@@ -48,274 +48,274 @@ |
||
| 48 | 48 | */ |
| 49 | 49 | class ProviderFactory implements IProviderFactory { |
| 50 | 50 | |
| 51 | - /** @var IServerContainer */ |
|
| 52 | - private $serverContainer; |
|
| 53 | - /** @var DefaultShareProvider */ |
|
| 54 | - private $defaultProvider = null; |
|
| 55 | - /** @var FederatedShareProvider */ |
|
| 56 | - private $federatedProvider = null; |
|
| 57 | - /** @var ShareByMailProvider */ |
|
| 58 | - private $shareByMailProvider; |
|
| 59 | - /** @var \OCA\Circles\ShareByCircleProvider */ |
|
| 60 | - private $shareByCircleProvider = null; |
|
| 61 | - /** @var bool */ |
|
| 62 | - private $circlesAreNotAvailable = false; |
|
| 63 | - /** @var \OCA\Spreed\Share\RoomShareProvider */ |
|
| 64 | - private $roomShareProvider = null; |
|
| 65 | - |
|
| 66 | - /** |
|
| 67 | - * IProviderFactory constructor. |
|
| 68 | - * |
|
| 69 | - * @param IServerContainer $serverContainer |
|
| 70 | - */ |
|
| 71 | - public function __construct(IServerContainer $serverContainer) { |
|
| 72 | - $this->serverContainer = $serverContainer; |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - /** |
|
| 76 | - * Create the default share provider. |
|
| 77 | - * |
|
| 78 | - * @return DefaultShareProvider |
|
| 79 | - */ |
|
| 80 | - protected function defaultShareProvider() { |
|
| 81 | - if ($this->defaultProvider === null) { |
|
| 82 | - $this->defaultProvider = new DefaultShareProvider( |
|
| 83 | - $this->serverContainer->getDatabaseConnection(), |
|
| 84 | - $this->serverContainer->getUserManager(), |
|
| 85 | - $this->serverContainer->getGroupManager(), |
|
| 86 | - $this->serverContainer->getLazyRootFolder(), |
|
| 87 | - $this->serverContainer->getMailer(), |
|
| 88 | - $this->serverContainer->query(Defaults::class), |
|
| 89 | - $this->serverContainer->getL10N('sharing'), |
|
| 90 | - $this->serverContainer->getURLGenerator() |
|
| 91 | - ); |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - return $this->defaultProvider; |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - /** |
|
| 98 | - * Create the federated share provider |
|
| 99 | - * |
|
| 100 | - * @return FederatedShareProvider |
|
| 101 | - */ |
|
| 102 | - protected function federatedShareProvider() { |
|
| 103 | - if ($this->federatedProvider === null) { |
|
| 104 | - /* |
|
| 51 | + /** @var IServerContainer */ |
|
| 52 | + private $serverContainer; |
|
| 53 | + /** @var DefaultShareProvider */ |
|
| 54 | + private $defaultProvider = null; |
|
| 55 | + /** @var FederatedShareProvider */ |
|
| 56 | + private $federatedProvider = null; |
|
| 57 | + /** @var ShareByMailProvider */ |
|
| 58 | + private $shareByMailProvider; |
|
| 59 | + /** @var \OCA\Circles\ShareByCircleProvider */ |
|
| 60 | + private $shareByCircleProvider = null; |
|
| 61 | + /** @var bool */ |
|
| 62 | + private $circlesAreNotAvailable = false; |
|
| 63 | + /** @var \OCA\Spreed\Share\RoomShareProvider */ |
|
| 64 | + private $roomShareProvider = null; |
|
| 65 | + |
|
| 66 | + /** |
|
| 67 | + * IProviderFactory constructor. |
|
| 68 | + * |
|
| 69 | + * @param IServerContainer $serverContainer |
|
| 70 | + */ |
|
| 71 | + public function __construct(IServerContainer $serverContainer) { |
|
| 72 | + $this->serverContainer = $serverContainer; |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + /** |
|
| 76 | + * Create the default share provider. |
|
| 77 | + * |
|
| 78 | + * @return DefaultShareProvider |
|
| 79 | + */ |
|
| 80 | + protected function defaultShareProvider() { |
|
| 81 | + if ($this->defaultProvider === null) { |
|
| 82 | + $this->defaultProvider = new DefaultShareProvider( |
|
| 83 | + $this->serverContainer->getDatabaseConnection(), |
|
| 84 | + $this->serverContainer->getUserManager(), |
|
| 85 | + $this->serverContainer->getGroupManager(), |
|
| 86 | + $this->serverContainer->getLazyRootFolder(), |
|
| 87 | + $this->serverContainer->getMailer(), |
|
| 88 | + $this->serverContainer->query(Defaults::class), |
|
| 89 | + $this->serverContainer->getL10N('sharing'), |
|
| 90 | + $this->serverContainer->getURLGenerator() |
|
| 91 | + ); |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + return $this->defaultProvider; |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + /** |
|
| 98 | + * Create the federated share provider |
|
| 99 | + * |
|
| 100 | + * @return FederatedShareProvider |
|
| 101 | + */ |
|
| 102 | + protected function federatedShareProvider() { |
|
| 103 | + if ($this->federatedProvider === null) { |
|
| 104 | + /* |
|
| 105 | 105 | * Check if the app is enabled |
| 106 | 106 | */ |
| 107 | - $appManager = $this->serverContainer->getAppManager(); |
|
| 108 | - if (!$appManager->isEnabledForUser('federatedfilesharing')) { |
|
| 109 | - return null; |
|
| 110 | - } |
|
| 107 | + $appManager = $this->serverContainer->getAppManager(); |
|
| 108 | + if (!$appManager->isEnabledForUser('federatedfilesharing')) { |
|
| 109 | + return null; |
|
| 110 | + } |
|
| 111 | 111 | |
| 112 | - /* |
|
| 112 | + /* |
|
| 113 | 113 | * TODO: add factory to federated sharing app |
| 114 | 114 | */ |
| 115 | - $l = $this->serverContainer->getL10N('federatedfilessharing'); |
|
| 116 | - $addressHandler = new AddressHandler( |
|
| 117 | - $this->serverContainer->getURLGenerator(), |
|
| 118 | - $l, |
|
| 119 | - $this->serverContainer->getCloudIdManager() |
|
| 120 | - ); |
|
| 121 | - $notifications = new Notifications( |
|
| 122 | - $addressHandler, |
|
| 123 | - $this->serverContainer->getHTTPClientService(), |
|
| 124 | - $this->serverContainer->query(\OCP\OCS\IDiscoveryService::class), |
|
| 125 | - $this->serverContainer->getJobList(), |
|
| 126 | - \OC::$server->getCloudFederationProviderManager(), |
|
| 127 | - \OC::$server->getCloudFederationFactory() |
|
| 128 | - ); |
|
| 129 | - $tokenHandler = new TokenHandler( |
|
| 130 | - $this->serverContainer->getSecureRandom() |
|
| 131 | - ); |
|
| 132 | - |
|
| 133 | - $this->federatedProvider = new FederatedShareProvider( |
|
| 134 | - $this->serverContainer->getDatabaseConnection(), |
|
| 135 | - $addressHandler, |
|
| 136 | - $notifications, |
|
| 137 | - $tokenHandler, |
|
| 138 | - $l, |
|
| 139 | - $this->serverContainer->getLogger(), |
|
| 140 | - $this->serverContainer->getLazyRootFolder(), |
|
| 141 | - $this->serverContainer->getConfig(), |
|
| 142 | - $this->serverContainer->getUserManager(), |
|
| 143 | - $this->serverContainer->getCloudIdManager(), |
|
| 144 | - $this->serverContainer->getGlobalScaleConfig(), |
|
| 145 | - $this->serverContainer->getCloudFederationProviderManager() |
|
| 146 | - ); |
|
| 147 | - } |
|
| 148 | - |
|
| 149 | - return $this->federatedProvider; |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - /** |
|
| 153 | - * Create the federated share provider |
|
| 154 | - * |
|
| 155 | - * @return ShareByMailProvider |
|
| 156 | - */ |
|
| 157 | - protected function getShareByMailProvider() { |
|
| 158 | - if ($this->shareByMailProvider === null) { |
|
| 159 | - /* |
|
| 115 | + $l = $this->serverContainer->getL10N('federatedfilessharing'); |
|
| 116 | + $addressHandler = new AddressHandler( |
|
| 117 | + $this->serverContainer->getURLGenerator(), |
|
| 118 | + $l, |
|
| 119 | + $this->serverContainer->getCloudIdManager() |
|
| 120 | + ); |
|
| 121 | + $notifications = new Notifications( |
|
| 122 | + $addressHandler, |
|
| 123 | + $this->serverContainer->getHTTPClientService(), |
|
| 124 | + $this->serverContainer->query(\OCP\OCS\IDiscoveryService::class), |
|
| 125 | + $this->serverContainer->getJobList(), |
|
| 126 | + \OC::$server->getCloudFederationProviderManager(), |
|
| 127 | + \OC::$server->getCloudFederationFactory() |
|
| 128 | + ); |
|
| 129 | + $tokenHandler = new TokenHandler( |
|
| 130 | + $this->serverContainer->getSecureRandom() |
|
| 131 | + ); |
|
| 132 | + |
|
| 133 | + $this->federatedProvider = new FederatedShareProvider( |
|
| 134 | + $this->serverContainer->getDatabaseConnection(), |
|
| 135 | + $addressHandler, |
|
| 136 | + $notifications, |
|
| 137 | + $tokenHandler, |
|
| 138 | + $l, |
|
| 139 | + $this->serverContainer->getLogger(), |
|
| 140 | + $this->serverContainer->getLazyRootFolder(), |
|
| 141 | + $this->serverContainer->getConfig(), |
|
| 142 | + $this->serverContainer->getUserManager(), |
|
| 143 | + $this->serverContainer->getCloudIdManager(), |
|
| 144 | + $this->serverContainer->getGlobalScaleConfig(), |
|
| 145 | + $this->serverContainer->getCloudFederationProviderManager() |
|
| 146 | + ); |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + return $this->federatedProvider; |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + /** |
|
| 153 | + * Create the federated share provider |
|
| 154 | + * |
|
| 155 | + * @return ShareByMailProvider |
|
| 156 | + */ |
|
| 157 | + protected function getShareByMailProvider() { |
|
| 158 | + if ($this->shareByMailProvider === null) { |
|
| 159 | + /* |
|
| 160 | 160 | * Check if the app is enabled |
| 161 | 161 | */ |
| 162 | - $appManager = $this->serverContainer->getAppManager(); |
|
| 163 | - if (!$appManager->isEnabledForUser('sharebymail')) { |
|
| 164 | - return null; |
|
| 165 | - } |
|
| 166 | - |
|
| 167 | - $settingsManager = new SettingsManager($this->serverContainer->getConfig()); |
|
| 168 | - |
|
| 169 | - $this->shareByMailProvider = new ShareByMailProvider( |
|
| 170 | - $this->serverContainer->getDatabaseConnection(), |
|
| 171 | - $this->serverContainer->getSecureRandom(), |
|
| 172 | - $this->serverContainer->getUserManager(), |
|
| 173 | - $this->serverContainer->getLazyRootFolder(), |
|
| 174 | - $this->serverContainer->getL10N('sharebymail'), |
|
| 175 | - $this->serverContainer->getLogger(), |
|
| 176 | - $this->serverContainer->getMailer(), |
|
| 177 | - $this->serverContainer->getURLGenerator(), |
|
| 178 | - $this->serverContainer->getActivityManager(), |
|
| 179 | - $settingsManager, |
|
| 180 | - $this->serverContainer->query(Defaults::class), |
|
| 181 | - $this->serverContainer->getHasher(), |
|
| 182 | - $this->serverContainer->query(CapabilitiesManager::class) |
|
| 183 | - ); |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - return $this->shareByMailProvider; |
|
| 187 | - } |
|
| 188 | - |
|
| 189 | - |
|
| 190 | - /** |
|
| 191 | - * Create the circle share provider |
|
| 192 | - * |
|
| 193 | - * @return FederatedShareProvider |
|
| 194 | - * |
|
| 195 | - * @suppress PhanUndeclaredClassMethod |
|
| 196 | - */ |
|
| 197 | - protected function getShareByCircleProvider() { |
|
| 198 | - |
|
| 199 | - if ($this->circlesAreNotAvailable) { |
|
| 200 | - return null; |
|
| 201 | - } |
|
| 202 | - |
|
| 203 | - if (!$this->serverContainer->getAppManager()->isEnabledForUser('circles') || |
|
| 204 | - !class_exists('\OCA\Circles\ShareByCircleProvider') |
|
| 205 | - ) { |
|
| 206 | - $this->circlesAreNotAvailable = true; |
|
| 207 | - return null; |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - if ($this->shareByCircleProvider === null) { |
|
| 211 | - |
|
| 212 | - $this->shareByCircleProvider = new \OCA\Circles\ShareByCircleProvider( |
|
| 213 | - $this->serverContainer->getDatabaseConnection(), |
|
| 214 | - $this->serverContainer->getSecureRandom(), |
|
| 215 | - $this->serverContainer->getUserManager(), |
|
| 216 | - $this->serverContainer->getLazyRootFolder(), |
|
| 217 | - $this->serverContainer->getL10N('circles'), |
|
| 218 | - $this->serverContainer->getLogger(), |
|
| 219 | - $this->serverContainer->getURLGenerator() |
|
| 220 | - ); |
|
| 221 | - } |
|
| 222 | - |
|
| 223 | - return $this->shareByCircleProvider; |
|
| 224 | - } |
|
| 225 | - |
|
| 226 | - /** |
|
| 227 | - * Create the room share provider |
|
| 228 | - * |
|
| 229 | - * @return RoomShareProvider |
|
| 230 | - */ |
|
| 231 | - protected function getRoomShareProvider() { |
|
| 232 | - if ($this->roomShareProvider === null) { |
|
| 233 | - /* |
|
| 162 | + $appManager = $this->serverContainer->getAppManager(); |
|
| 163 | + if (!$appManager->isEnabledForUser('sharebymail')) { |
|
| 164 | + return null; |
|
| 165 | + } |
|
| 166 | + |
|
| 167 | + $settingsManager = new SettingsManager($this->serverContainer->getConfig()); |
|
| 168 | + |
|
| 169 | + $this->shareByMailProvider = new ShareByMailProvider( |
|
| 170 | + $this->serverContainer->getDatabaseConnection(), |
|
| 171 | + $this->serverContainer->getSecureRandom(), |
|
| 172 | + $this->serverContainer->getUserManager(), |
|
| 173 | + $this->serverContainer->getLazyRootFolder(), |
|
| 174 | + $this->serverContainer->getL10N('sharebymail'), |
|
| 175 | + $this->serverContainer->getLogger(), |
|
| 176 | + $this->serverContainer->getMailer(), |
|
| 177 | + $this->serverContainer->getURLGenerator(), |
|
| 178 | + $this->serverContainer->getActivityManager(), |
|
| 179 | + $settingsManager, |
|
| 180 | + $this->serverContainer->query(Defaults::class), |
|
| 181 | + $this->serverContainer->getHasher(), |
|
| 182 | + $this->serverContainer->query(CapabilitiesManager::class) |
|
| 183 | + ); |
|
| 184 | + } |
|
| 185 | + |
|
| 186 | + return $this->shareByMailProvider; |
|
| 187 | + } |
|
| 188 | + |
|
| 189 | + |
|
| 190 | + /** |
|
| 191 | + * Create the circle share provider |
|
| 192 | + * |
|
| 193 | + * @return FederatedShareProvider |
|
| 194 | + * |
|
| 195 | + * @suppress PhanUndeclaredClassMethod |
|
| 196 | + */ |
|
| 197 | + protected function getShareByCircleProvider() { |
|
| 198 | + |
|
| 199 | + if ($this->circlesAreNotAvailable) { |
|
| 200 | + return null; |
|
| 201 | + } |
|
| 202 | + |
|
| 203 | + if (!$this->serverContainer->getAppManager()->isEnabledForUser('circles') || |
|
| 204 | + !class_exists('\OCA\Circles\ShareByCircleProvider') |
|
| 205 | + ) { |
|
| 206 | + $this->circlesAreNotAvailable = true; |
|
| 207 | + return null; |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + if ($this->shareByCircleProvider === null) { |
|
| 211 | + |
|
| 212 | + $this->shareByCircleProvider = new \OCA\Circles\ShareByCircleProvider( |
|
| 213 | + $this->serverContainer->getDatabaseConnection(), |
|
| 214 | + $this->serverContainer->getSecureRandom(), |
|
| 215 | + $this->serverContainer->getUserManager(), |
|
| 216 | + $this->serverContainer->getLazyRootFolder(), |
|
| 217 | + $this->serverContainer->getL10N('circles'), |
|
| 218 | + $this->serverContainer->getLogger(), |
|
| 219 | + $this->serverContainer->getURLGenerator() |
|
| 220 | + ); |
|
| 221 | + } |
|
| 222 | + |
|
| 223 | + return $this->shareByCircleProvider; |
|
| 224 | + } |
|
| 225 | + |
|
| 226 | + /** |
|
| 227 | + * Create the room share provider |
|
| 228 | + * |
|
| 229 | + * @return RoomShareProvider |
|
| 230 | + */ |
|
| 231 | + protected function getRoomShareProvider() { |
|
| 232 | + if ($this->roomShareProvider === null) { |
|
| 233 | + /* |
|
| 234 | 234 | * Check if the app is enabled |
| 235 | 235 | */ |
| 236 | - $appManager = $this->serverContainer->getAppManager(); |
|
| 237 | - if (!$appManager->isEnabledForUser('spreed')) { |
|
| 238 | - return null; |
|
| 239 | - } |
|
| 240 | - |
|
| 241 | - try { |
|
| 242 | - $this->roomShareProvider = $this->serverContainer->query('\OCA\Spreed\Share\RoomShareProvider'); |
|
| 243 | - } catch (\OCP\AppFramework\QueryException $e) { |
|
| 244 | - return null; |
|
| 245 | - } |
|
| 246 | - } |
|
| 247 | - |
|
| 248 | - return $this->roomShareProvider; |
|
| 249 | - } |
|
| 250 | - |
|
| 251 | - /** |
|
| 252 | - * @inheritdoc |
|
| 253 | - */ |
|
| 254 | - public function getProvider($id) { |
|
| 255 | - $provider = null; |
|
| 256 | - if ($id === 'ocinternal') { |
|
| 257 | - $provider = $this->defaultShareProvider(); |
|
| 258 | - } else if ($id === 'ocFederatedSharing') { |
|
| 259 | - $provider = $this->federatedShareProvider(); |
|
| 260 | - } else if ($id === 'ocMailShare') { |
|
| 261 | - $provider = $this->getShareByMailProvider(); |
|
| 262 | - } else if ($id === 'ocCircleShare') { |
|
| 263 | - $provider = $this->getShareByCircleProvider(); |
|
| 264 | - } else if ($id === 'ocRoomShare') { |
|
| 265 | - $provider = $this->getRoomShareProvider(); |
|
| 266 | - } |
|
| 267 | - |
|
| 268 | - if ($provider === null) { |
|
| 269 | - throw new ProviderException('No provider with id .' . $id . ' found.'); |
|
| 270 | - } |
|
| 271 | - |
|
| 272 | - return $provider; |
|
| 273 | - } |
|
| 274 | - |
|
| 275 | - /** |
|
| 276 | - * @inheritdoc |
|
| 277 | - */ |
|
| 278 | - public function getProviderForType($shareType) { |
|
| 279 | - $provider = null; |
|
| 280 | - |
|
| 281 | - if ($shareType === \OCP\Share::SHARE_TYPE_USER || |
|
| 282 | - $shareType === \OCP\Share::SHARE_TYPE_GROUP || |
|
| 283 | - $shareType === \OCP\Share::SHARE_TYPE_LINK |
|
| 284 | - ) { |
|
| 285 | - $provider = $this->defaultShareProvider(); |
|
| 286 | - } else if ($shareType === \OCP\Share::SHARE_TYPE_REMOTE || $shareType === \OCP\Share::SHARE_TYPE_REMOTE_GROUP) { |
|
| 287 | - $provider = $this->federatedShareProvider(); |
|
| 288 | - } else if ($shareType === \OCP\Share::SHARE_TYPE_EMAIL) { |
|
| 289 | - $provider = $this->getShareByMailProvider(); |
|
| 290 | - } else if ($shareType === \OCP\Share::SHARE_TYPE_CIRCLE) { |
|
| 291 | - $provider = $this->getShareByCircleProvider(); |
|
| 292 | - } else if ($shareType === \OCP\Share::SHARE_TYPE_ROOM) { |
|
| 293 | - $provider = $this->getRoomShareProvider(); |
|
| 294 | - } |
|
| 295 | - |
|
| 296 | - |
|
| 297 | - if ($provider === null) { |
|
| 298 | - throw new ProviderException('No share provider for share type ' . $shareType); |
|
| 299 | - } |
|
| 300 | - |
|
| 301 | - return $provider; |
|
| 302 | - } |
|
| 303 | - |
|
| 304 | - public function getAllProviders() { |
|
| 305 | - $shares = [$this->defaultShareProvider(), $this->federatedShareProvider()]; |
|
| 306 | - $shareByMail = $this->getShareByMailProvider(); |
|
| 307 | - if ($shareByMail !== null) { |
|
| 308 | - $shares[] = $shareByMail; |
|
| 309 | - } |
|
| 310 | - $shareByCircle = $this->getShareByCircleProvider(); |
|
| 311 | - if ($shareByCircle !== null) { |
|
| 312 | - $shares[] = $shareByCircle; |
|
| 313 | - } |
|
| 314 | - $roomShare = $this->getRoomShareProvider(); |
|
| 315 | - if ($roomShare !== null) { |
|
| 316 | - $shares[] = $roomShare; |
|
| 317 | - } |
|
| 318 | - |
|
| 319 | - return $shares; |
|
| 320 | - } |
|
| 236 | + $appManager = $this->serverContainer->getAppManager(); |
|
| 237 | + if (!$appManager->isEnabledForUser('spreed')) { |
|
| 238 | + return null; |
|
| 239 | + } |
|
| 240 | + |
|
| 241 | + try { |
|
| 242 | + $this->roomShareProvider = $this->serverContainer->query('\OCA\Spreed\Share\RoomShareProvider'); |
|
| 243 | + } catch (\OCP\AppFramework\QueryException $e) { |
|
| 244 | + return null; |
|
| 245 | + } |
|
| 246 | + } |
|
| 247 | + |
|
| 248 | + return $this->roomShareProvider; |
|
| 249 | + } |
|
| 250 | + |
|
| 251 | + /** |
|
| 252 | + * @inheritdoc |
|
| 253 | + */ |
|
| 254 | + public function getProvider($id) { |
|
| 255 | + $provider = null; |
|
| 256 | + if ($id === 'ocinternal') { |
|
| 257 | + $provider = $this->defaultShareProvider(); |
|
| 258 | + } else if ($id === 'ocFederatedSharing') { |
|
| 259 | + $provider = $this->federatedShareProvider(); |
|
| 260 | + } else if ($id === 'ocMailShare') { |
|
| 261 | + $provider = $this->getShareByMailProvider(); |
|
| 262 | + } else if ($id === 'ocCircleShare') { |
|
| 263 | + $provider = $this->getShareByCircleProvider(); |
|
| 264 | + } else if ($id === 'ocRoomShare') { |
|
| 265 | + $provider = $this->getRoomShareProvider(); |
|
| 266 | + } |
|
| 267 | + |
|
| 268 | + if ($provider === null) { |
|
| 269 | + throw new ProviderException('No provider with id .' . $id . ' found.'); |
|
| 270 | + } |
|
| 271 | + |
|
| 272 | + return $provider; |
|
| 273 | + } |
|
| 274 | + |
|
| 275 | + /** |
|
| 276 | + * @inheritdoc |
|
| 277 | + */ |
|
| 278 | + public function getProviderForType($shareType) { |
|
| 279 | + $provider = null; |
|
| 280 | + |
|
| 281 | + if ($shareType === \OCP\Share::SHARE_TYPE_USER || |
|
| 282 | + $shareType === \OCP\Share::SHARE_TYPE_GROUP || |
|
| 283 | + $shareType === \OCP\Share::SHARE_TYPE_LINK |
|
| 284 | + ) { |
|
| 285 | + $provider = $this->defaultShareProvider(); |
|
| 286 | + } else if ($shareType === \OCP\Share::SHARE_TYPE_REMOTE || $shareType === \OCP\Share::SHARE_TYPE_REMOTE_GROUP) { |
|
| 287 | + $provider = $this->federatedShareProvider(); |
|
| 288 | + } else if ($shareType === \OCP\Share::SHARE_TYPE_EMAIL) { |
|
| 289 | + $provider = $this->getShareByMailProvider(); |
|
| 290 | + } else if ($shareType === \OCP\Share::SHARE_TYPE_CIRCLE) { |
|
| 291 | + $provider = $this->getShareByCircleProvider(); |
|
| 292 | + } else if ($shareType === \OCP\Share::SHARE_TYPE_ROOM) { |
|
| 293 | + $provider = $this->getRoomShareProvider(); |
|
| 294 | + } |
|
| 295 | + |
|
| 296 | + |
|
| 297 | + if ($provider === null) { |
|
| 298 | + throw new ProviderException('No share provider for share type ' . $shareType); |
|
| 299 | + } |
|
| 300 | + |
|
| 301 | + return $provider; |
|
| 302 | + } |
|
| 303 | + |
|
| 304 | + public function getAllProviders() { |
|
| 305 | + $shares = [$this->defaultShareProvider(), $this->federatedShareProvider()]; |
|
| 306 | + $shareByMail = $this->getShareByMailProvider(); |
|
| 307 | + if ($shareByMail !== null) { |
|
| 308 | + $shares[] = $shareByMail; |
|
| 309 | + } |
|
| 310 | + $shareByCircle = $this->getShareByCircleProvider(); |
|
| 311 | + if ($shareByCircle !== null) { |
|
| 312 | + $shares[] = $shareByCircle; |
|
| 313 | + } |
|
| 314 | + $roomShare = $this->getRoomShareProvider(); |
|
| 315 | + if ($roomShare !== null) { |
|
| 316 | + $shares[] = $roomShare; |
|
| 317 | + } |
|
| 318 | + |
|
| 319 | + return $shares; |
|
| 320 | + } |
|
| 321 | 321 | } |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | $eventDispatcher->addListener(MapperEvent::EVENT_ASSIGN, $mapperListener); |
| 66 | 66 | $eventDispatcher->addListener(MapperEvent::EVENT_UNASSIGN, $mapperListener); |
| 67 | 67 | |
| 68 | -\OCA\Files\App::getNavigationManager()->add(function () { |
|
| 68 | +\OCA\Files\App::getNavigationManager()->add(function() { |
|
| 69 | 69 | $l = \OC::$server->getL10N('systemtags'); |
| 70 | 70 | return [ |
| 71 | 71 | 'id' => 'systemtagsfilter', |
@@ -30,19 +30,19 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | $eventDispatcher = \OC::$server->getEventDispatcher(); |
| 32 | 32 | $eventDispatcher->addListener( |
| 33 | - 'OCA\Files::loadAdditionalScripts', |
|
| 34 | - function() { |
|
| 35 | - // FIXME: no public API for these ? |
|
| 36 | - \OCP\Util::addScript('dist/systemtags'); |
|
| 37 | - \OCP\Util::addScript('systemtags', 'systemtags'); |
|
| 38 | - } |
|
| 33 | + 'OCA\Files::loadAdditionalScripts', |
|
| 34 | + function() { |
|
| 35 | + // FIXME: no public API for these ? |
|
| 36 | + \OCP\Util::addScript('dist/systemtags'); |
|
| 37 | + \OCP\Util::addScript('systemtags', 'systemtags'); |
|
| 38 | + } |
|
| 39 | 39 | ); |
| 40 | 40 | |
| 41 | 41 | $managerListener = function(ManagerEvent $event) { |
| 42 | - $application = new \OCP\AppFramework\App('systemtags'); |
|
| 43 | - /** @var \OCA\SystemTags\Activity\Listener $listener */ |
|
| 44 | - $listener = $application->getContainer()->query(Listener::class); |
|
| 45 | - $listener->event($event); |
|
| 42 | + $application = new \OCP\AppFramework\App('systemtags'); |
|
| 43 | + /** @var \OCA\SystemTags\Activity\Listener $listener */ |
|
| 44 | + $listener = $application->getContainer()->query(Listener::class); |
|
| 45 | + $listener->event($event); |
|
| 46 | 46 | }; |
| 47 | 47 | |
| 48 | 48 | $eventDispatcher->addListener(ManagerEvent::EVENT_CREATE, $managerListener); |
@@ -50,23 +50,23 @@ discard block |
||
| 50 | 50 | $eventDispatcher->addListener(ManagerEvent::EVENT_UPDATE, $managerListener); |
| 51 | 51 | |
| 52 | 52 | $mapperListener = function(MapperEvent $event) { |
| 53 | - $application = new \OCP\AppFramework\App('systemtags'); |
|
| 54 | - /** @var \OCA\SystemTags\Activity\Listener $listener */ |
|
| 55 | - $listener = $application->getContainer()->query(Listener::class); |
|
| 56 | - $listener->mapperEvent($event); |
|
| 53 | + $application = new \OCP\AppFramework\App('systemtags'); |
|
| 54 | + /** @var \OCA\SystemTags\Activity\Listener $listener */ |
|
| 55 | + $listener = $application->getContainer()->query(Listener::class); |
|
| 56 | + $listener->mapperEvent($event); |
|
| 57 | 57 | }; |
| 58 | 58 | |
| 59 | 59 | $eventDispatcher->addListener(MapperEvent::EVENT_ASSIGN, $mapperListener); |
| 60 | 60 | $eventDispatcher->addListener(MapperEvent::EVENT_UNASSIGN, $mapperListener); |
| 61 | 61 | |
| 62 | 62 | \OCA\Files\App::getNavigationManager()->add(function () { |
| 63 | - $l = \OC::$server->getL10N('systemtags'); |
|
| 64 | - return [ |
|
| 65 | - 'id' => 'systemtagsfilter', |
|
| 66 | - 'appname' => 'systemtags', |
|
| 67 | - 'script' => 'list.php', |
|
| 68 | - 'order' => 25, |
|
| 69 | - 'name' => $l->t('Tags'), |
|
| 70 | - ]; |
|
| 63 | + $l = \OC::$server->getL10N('systemtags'); |
|
| 64 | + return [ |
|
| 65 | + 'id' => 'systemtagsfilter', |
|
| 66 | + 'appname' => 'systemtags', |
|
| 67 | + 'script' => 'list.php', |
|
| 68 | + 'order' => 25, |
|
| 69 | + 'name' => $l->t('Tags'), |
|
| 70 | + ]; |
|
| 71 | 71 | }); |
| 72 | 72 | |