|
@@ -153,7 +153,7 @@ discard block |
|
|
block discarded – undo |
|
153
|
153
|
public function showAuthenticate($token) { |
|
154
|
154
|
$share = $this->shareManager->getShareByToken($token); |
|
155
|
155
|
|
|
156
|
|
- if($this->linkShareAuth($share)) { |
|
|
156
|
+ if ($this->linkShareAuth($share)) { |
|
157
|
157
|
return new RedirectResponse($this->urlGenerator->linkToRoute('files_sharing.sharecontroller.showShare', array('token' => $token))); |
|
158
|
158
|
} |
|
159
|
159
|
|
|
@@ -181,7 +181,7 @@ discard block |
|
|
block discarded – undo |
|
181
|
181
|
|
|
182
|
182
|
$authenticate = $this->linkShareAuth($share, $password); |
|
183
|
183
|
|
|
184
|
|
- if($authenticate === true) { |
|
|
184
|
+ if ($authenticate === true) { |
|
185
|
185
|
return new RedirectResponse($this->urlGenerator->linkToRoute('files_sharing.sharecontroller.showShare', array('token' => $token))); |
|
186
|
186
|
} |
|
187
|
187
|
|
|
@@ -205,15 +205,15 @@ discard block |
|
|
block discarded – undo |
|
205
|
205
|
if ($password !== null) { |
|
206
|
206
|
if ($this->shareManager->checkPassword($share, $password)) { |
|
207
|
207
|
$this->session->regenerateId(true, true); |
|
208
|
|
- $this->session->set('public_link_authenticated', (string)$share->getId()); |
|
|
208
|
+ $this->session->set('public_link_authenticated', (string) $share->getId()); |
|
209
|
209
|
} else { |
|
210
|
210
|
$this->emitAccessShareHook($share, 403, 'Wrong password'); |
|
211
|
211
|
return false; |
|
212
|
212
|
} |
|
213
|
213
|
} else { |
|
214
|
214
|
// not authenticated ? |
|
215
|
|
- if ( ! $this->session->exists('public_link_authenticated') |
|
216
|
|
- || $this->session->get('public_link_authenticated') !== (string)$share->getId()) { |
|
|
215
|
+ if (!$this->session->exists('public_link_authenticated') |
|
|
216
|
+ || $this->session->get('public_link_authenticated') !== (string) $share->getId()) { |
|
217
|
217
|
return false; |
|
218
|
218
|
} |
|
219
|
219
|
} |
|
@@ -234,7 +234,7 @@ discard block |
|
|
block discarded – undo |
|
234
|
234
|
$itemType = $itemSource = $uidOwner = ''; |
|
235
|
235
|
$token = $share; |
|
236
|
236
|
$exception = null; |
|
237
|
|
- if($share instanceof \OCP\Share\IShare) { |
|
|
237
|
+ if ($share instanceof \OCP\Share\IShare) { |
|
238
|
238
|
try { |
|
239
|
239
|
$token = $share->getToken(); |
|
240
|
240
|
$uidOwner = $share->getSharedBy(); |
|
@@ -253,7 +253,7 @@ discard block |
|
|
block discarded – undo |
|
253
|
253
|
'errorCode' => $errorCode, |
|
254
|
254
|
'errorMessage' => $errorMessage, |
|
255
|
255
|
]); |
|
256
|
|
- if(!is_null($exception)) { |
|
|
256
|
+ if (!is_null($exception)) { |
|
257
|
257
|
throw $exception; |
|
258
|
258
|
} |
|
259
|
259
|
} |
|
@@ -379,7 +379,7 @@ discard block |
|
|
block discarded – undo |
|
379
|
379
|
$shareTmpl['previewURL'] = $shareTmpl['downloadURL']; |
|
380
|
380
|
$ogPreview = ''; |
|
381
|
381
|
if ($shareTmpl['previewSupported']) { |
|
382
|
|
- $shareTmpl['previewImage'] = $this->urlGenerator->linkToRouteAbsolute( 'files_sharing.PublicPreview.getPreview', |
|
|
382
|
+ $shareTmpl['previewImage'] = $this->urlGenerator->linkToRouteAbsolute('files_sharing.PublicPreview.getPreview', |
|
383
|
383
|
['x' => 200, 'y' => 200, 'file' => $shareTmpl['directory_path'], 't' => $shareTmpl['dirToken']]); |
|
384
|
384
|
$ogPreview = $shareTmpl['previewImage']; |
|
385
|
385
|
|
|
@@ -427,7 +427,7 @@ discard block |
|
|
block discarded – undo |
|
427
|
427
|
|
|
428
|
428
|
// OpenGraph Support: http://ogp.me/ |
|
429
|
429
|
\OCP\Util::addHeader('meta', ['property' => "og:title", 'content' => $shareTmpl['filename']]); |
|
430
|
|
- \OCP\Util::addHeader('meta', ['property' => "og:description", 'content' => $this->defaults->getName() . ($this->defaults->getSlogan() !== '' ? ' - ' . $this->defaults->getSlogan() : '')]); |
|
|
430
|
+ \OCP\Util::addHeader('meta', ['property' => "og:description", 'content' => $this->defaults->getName().($this->defaults->getSlogan() !== '' ? ' - '.$this->defaults->getSlogan() : '')]); |
|
431
|
431
|
\OCP\Util::addHeader('meta', ['property' => "og:site_name", 'content' => $this->defaults->getName()]); |
|
432
|
432
|
\OCP\Util::addHeader('meta', ['property' => "og:url", 'content' => $shareTmpl['shareUrl']]); |
|
433
|
433
|
\OCP\Util::addHeader('meta', ['property' => "og:type", 'content' => "object"]); |
|
@@ -461,7 +461,7 @@ discard block |
|
|
block discarded – undo |
|
461
|
461
|
|
|
462
|
462
|
$share = $this->shareManager->getShareByToken($token); |
|
463
|
463
|
|
|
464
|
|
- if(!($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) { |
|
|
464
|
+ if (!($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) { |
|
465
|
465
|
return new \OCP\AppFramework\Http\DataResponse('Share is read-only'); |
|
466
|
466
|
} |
|
467
|
467
|
|
|
@@ -543,7 +543,7 @@ discard block |
|
|
block discarded – undo |
|
543
|
543
|
|
|
544
|
544
|
$this->emitAccessShareHook($share); |
|
545
|
545
|
|
|
546
|
|
- $server_params = array( 'head' => $this->request->getMethod() === 'HEAD' ); |
|
|
546
|
+ $server_params = array('head' => $this->request->getMethod() === 'HEAD'); |
|
547
|
547
|
|
|
548
|
548
|
/** |
|
549
|
549
|
* Http range requests support |