|
@@ -156,7 +156,7 @@ discard block |
|
|
block discarded – undo |
|
156
|
156
|
public function showAuthenticate($token) { |
|
157
|
157
|
$share = $this->shareManager->getShareByToken($token); |
|
158
|
158
|
|
|
159
|
|
- if($this->linkShareAuth($share)) { |
|
|
159
|
+ if ($this->linkShareAuth($share)) { |
|
160
|
160
|
return new RedirectResponse($this->urlGenerator->linkToRoute('files_sharing.sharecontroller.showShare', array('token' => $token))); |
|
161
|
161
|
} |
|
162
|
162
|
|
|
@@ -218,15 +218,15 @@ discard block |
|
|
block discarded – undo |
|
218
|
218
|
if ($password !== null) { |
|
219
|
219
|
if ($this->shareManager->checkPassword($share, $password)) { |
|
220
|
220
|
$this->session->regenerateId(true, true); |
|
221
|
|
- $this->session->set('public_link_authenticated', (string)$share->getId()); |
|
|
221
|
+ $this->session->set('public_link_authenticated', (string) $share->getId()); |
|
222
|
222
|
} else { |
|
223
|
223
|
$this->emitAccessShareHook($share, 403, 'Wrong password'); |
|
224
|
224
|
return false; |
|
225
|
225
|
} |
|
226
|
226
|
} else { |
|
227
|
227
|
// not authenticated ? |
|
228
|
|
- if ( ! $this->session->exists('public_link_authenticated') |
|
229
|
|
- || $this->session->get('public_link_authenticated') !== (string)$share->getId()) { |
|
|
228
|
+ if (!$this->session->exists('public_link_authenticated') |
|
|
229
|
+ || $this->session->get('public_link_authenticated') !== (string) $share->getId()) { |
|
230
|
230
|
return false; |
|
231
|
231
|
} |
|
232
|
232
|
} |
|
@@ -247,7 +247,7 @@ discard block |
|
|
block discarded – undo |
|
247
|
247
|
$itemType = $itemSource = $uidOwner = ''; |
|
248
|
248
|
$token = $share; |
|
249
|
249
|
$exception = null; |
|
250
|
|
- if($share instanceof \OCP\Share\IShare) { |
|
|
250
|
+ if ($share instanceof \OCP\Share\IShare) { |
|
251
|
251
|
try { |
|
252
|
252
|
$token = $share->getToken(); |
|
253
|
253
|
$uidOwner = $share->getSharedBy(); |
|
@@ -266,7 +266,7 @@ discard block |
|
|
block discarded – undo |
|
266
|
266
|
'errorCode' => $errorCode, |
|
267
|
267
|
'errorMessage' => $errorMessage, |
|
268
|
268
|
]); |
|
269
|
|
- if(!is_null($exception)) { |
|
|
269
|
+ if (!is_null($exception)) { |
|
270
|
270
|
throw $exception; |
|
271
|
271
|
} |
|
272
|
272
|
} |
|
@@ -392,7 +392,7 @@ discard block |
|
|
block discarded – undo |
|
392
|
392
|
$shareTmpl['previewURL'] = $shareTmpl['downloadURL']; |
|
393
|
393
|
$ogPreview = ''; |
|
394
|
394
|
if ($shareTmpl['previewSupported']) { |
|
395
|
|
- $shareTmpl['previewImage'] = $this->urlGenerator->linkToRouteAbsolute( 'files_sharing.PublicPreview.getPreview', |
|
|
395
|
+ $shareTmpl['previewImage'] = $this->urlGenerator->linkToRouteAbsolute('files_sharing.PublicPreview.getPreview', |
|
396
|
396
|
['x' => 200, 'y' => 200, 'file' => $shareTmpl['directory_path'], 't' => $shareTmpl['dirToken']]); |
|
397
|
397
|
$ogPreview = $shareTmpl['previewImage']; |
|
398
|
398
|
|
|
@@ -440,7 +440,7 @@ discard block |
|
|
block discarded – undo |
|
440
|
440
|
|
|
441
|
441
|
// OpenGraph Support: http://ogp.me/ |
|
442
|
442
|
\OCP\Util::addHeader('meta', ['property' => "og:title", 'content' => $shareTmpl['filename']]); |
|
443
|
|
- \OCP\Util::addHeader('meta', ['property' => "og:description", 'content' => $this->defaults->getName() . ($this->defaults->getSlogan() !== '' ? ' - ' . $this->defaults->getSlogan() : '')]); |
|
|
443
|
+ \OCP\Util::addHeader('meta', ['property' => "og:description", 'content' => $this->defaults->getName().($this->defaults->getSlogan() !== '' ? ' - '.$this->defaults->getSlogan() : '')]); |
|
444
|
444
|
\OCP\Util::addHeader('meta', ['property' => "og:site_name", 'content' => $this->defaults->getName()]); |
|
445
|
445
|
\OCP\Util::addHeader('meta', ['property' => "og:url", 'content' => $shareTmpl['shareUrl']]); |
|
446
|
446
|
\OCP\Util::addHeader('meta', ['property' => "og:type", 'content' => "object"]); |
|
@@ -484,7 +484,7 @@ discard block |
|
|
block discarded – undo |
|
484
|
484
|
|
|
485
|
485
|
$share = $this->shareManager->getShareByToken($token); |
|
486
|
486
|
|
|
487
|
|
- if(!($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) { |
|
|
487
|
+ if (!($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) { |
|
488
|
488
|
return new \OCP\AppFramework\Http\DataResponse('Share is read-only'); |
|
489
|
489
|
} |
|
490
|
490
|
|
|
@@ -566,7 +566,7 @@ discard block |
|
|
block discarded – undo |
|
566
|
566
|
|
|
567
|
567
|
$this->emitAccessShareHook($share); |
|
568
|
568
|
|
|
569
|
|
- $server_params = array( 'head' => $this->request->getMethod() === 'HEAD' ); |
|
|
569
|
+ $server_params = array('head' => $this->request->getMethod() === 'HEAD'); |
|
570
|
570
|
|
|
571
|
571
|
/** |
|
572
|
572
|
* Http range requests support |