@@ -217,11 +217,11 @@ discard block |
||
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | $data = array( |
| 220 | - 'attendee_name' => (string)$meetingAttendeeName ?: $defaultVal, |
|
| 221 | - 'invitee_name' => (string)$meetingInviteeName ?: $defaultVal, |
|
| 222 | - 'meeting_title' => (string)$meetingTitle ?: $defaultVal, |
|
| 223 | - 'meeting_description' => (string)$meetingDescription ?: $defaultVal, |
|
| 224 | - 'meeting_url' => (string)$meetingUrl ?: $defaultVal, |
|
| 220 | + 'attendee_name' => (string) $meetingAttendeeName ?: $defaultVal, |
|
| 221 | + 'invitee_name' => (string) $meetingInviteeName ?: $defaultVal, |
|
| 222 | + 'meeting_title' => (string) $meetingTitle ?: $defaultVal, |
|
| 223 | + 'meeting_description' => (string) $meetingDescription ?: $defaultVal, |
|
| 224 | + 'meeting_url' => (string) $meetingUrl ?: $defaultVal, |
|
| 225 | 225 | ); |
| 226 | 226 | |
| 227 | 227 | $fromEMail = \OCP\Util::getDefaultEmailAddress('invitations-noreply'); |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | ->setReplyTo([$sender => $senderName]) |
| 233 | 233 | ->setTo([$recipient => $recipientName]); |
| 234 | 234 | |
| 235 | - $template = $this->mailer->createEMailTemplate('dav.calendarInvite.' . $method, $data); |
|
| 235 | + $template = $this->mailer->createEMailTemplate('dav.calendarInvite.'.$method, $data); |
|
| 236 | 236 | $template->addHeader(); |
| 237 | 237 | |
| 238 | 238 | $this->addSubjectAndHeading($template, $l10n, $method, $summary, |
@@ -246,8 +246,8 @@ discard block |
||
| 246 | 246 | |
| 247 | 247 | $attachment = $this->mailer->createAttachment( |
| 248 | 248 | $iTipMessage->message->serialize(), |
| 249 | - 'event.ics',// TODO(leon): Make file name unique, e.g. add event id |
|
| 250 | - 'text/calendar; method=' . $iTipMessage->method |
|
| 249 | + 'event.ics', // TODO(leon): Make file name unique, e.g. add event id |
|
| 250 | + 'text/calendar; method='.$iTipMessage->method |
|
| 251 | 251 | ); |
| 252 | 252 | $message->attach($attachment); |
| 253 | 253 | |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | $this->logger->error('Unable to deliver message to {failed}', ['app' => 'dav', 'failed' => implode(', ', $failed)]); |
| 259 | 259 | $iTipMessage->scheduleStatus = '5.0; EMail delivery failed'; |
| 260 | 260 | } |
| 261 | - } catch(\Exception $ex) { |
|
| 261 | + } catch (\Exception $ex) { |
|
| 262 | 262 | $this->logger->logException($ex, ['app' => 'dav']); |
| 263 | 263 | $iTipMessage->scheduleStatus = '5.0; EMail delivery failed'; |
| 264 | 264 | } |
@@ -294,13 +294,13 @@ discard block |
||
| 294 | 294 | $lastOccurrence = $firstOccurrence; |
| 295 | 295 | } |
| 296 | 296 | } else { |
| 297 | - $it = new EventIterator($vObject, (string)$component->UID); |
|
| 297 | + $it = new EventIterator($vObject, (string) $component->UID); |
|
| 298 | 298 | $maxDate = new \DateTime(self::MAX_DATE); |
| 299 | 299 | if ($it->isInfinite()) { |
| 300 | 300 | $lastOccurrence = $maxDate->getTimestamp(); |
| 301 | 301 | } else { |
| 302 | 302 | $end = $it->getDtEnd(); |
| 303 | - while($it->valid() && $end < $maxDate) { |
|
| 303 | + while ($it->valid() && $end < $maxDate) { |
|
| 304 | 304 | $end = $it->getDtEnd(); |
| 305 | 305 | $it->next(); |
| 306 | 306 | |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | $localeStart = $l10n->l('date', $dtstartDt, ['width' => 'medium']); |
| 376 | 376 | $localeEnd = $l10n->l('date', $dtendDt, ['width' => 'medium']); |
| 377 | 377 | |
| 378 | - return $localeStart . ' - ' . $localeEnd; |
|
| 378 | + return $localeStart.' - '.$localeEnd; |
|
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | /** @var Property\ICalendar\DateTime $dtstart */ |
@@ -394,26 +394,26 @@ discard block |
||
| 394 | 394 | } |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | - $localeStart = $l10n->l('weekdayName', $dtstartDt, ['width' => 'abbreviated']) . ', ' . |
|
| 397 | + $localeStart = $l10n->l('weekdayName', $dtstartDt, ['width' => 'abbreviated']).', '. |
|
| 398 | 398 | $l10n->l('datetime', $dtstartDt, ['width' => 'medium|short']); |
| 399 | 399 | |
| 400 | 400 | // always show full date with timezone if timezones are different |
| 401 | 401 | if ($startTimezone !== $endTimezone) { |
| 402 | 402 | $localeEnd = $l10n->l('datetime', $dtendDt, ['width' => 'medium|short']); |
| 403 | 403 | |
| 404 | - return $localeStart . ' (' . $startTimezone . ') - ' . |
|
| 405 | - $localeEnd . ' (' . $endTimezone . ')'; |
|
| 404 | + return $localeStart.' ('.$startTimezone.') - '. |
|
| 405 | + $localeEnd.' ('.$endTimezone.')'; |
|
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | // show only end time if date is the same |
| 409 | 409 | if ($this->isDayEqual($dtstartDt, $dtendDt)) { |
| 410 | 410 | $localeEnd = $l10n->l('time', $dtendDt, ['width' => 'short']); |
| 411 | 411 | } else { |
| 412 | - $localeEnd = $l10n->l('weekdayName', $dtendDt, ['width' => 'abbreviated']) . ', ' . |
|
| 412 | + $localeEnd = $l10n->l('weekdayName', $dtendDt, ['width' => 'abbreviated']).', '. |
|
| 413 | 413 | $l10n->l('datetime', $dtendDt, ['width' => 'medium|short']); |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | - return $localeStart . ' - ' . $localeEnd . ' (' . $startTimezone . ')'; |
|
| 416 | + return $localeStart.' - '.$localeEnd.' ('.$startTimezone.')'; |
|
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | /** |
@@ -436,15 +436,15 @@ discard block |
||
| 436 | 436 | private function addSubjectAndHeading(IEMailTemplate $template, IL10N $l10n, |
| 437 | 437 | $method, $summary, $attendeeName, $inviteeName) { |
| 438 | 438 | if ($method === self::METHOD_CANCEL) { |
| 439 | - $template->setSubject('Cancelled: ' . $summary); |
|
| 439 | + $template->setSubject('Cancelled: '.$summary); |
|
| 440 | 440 | $template->addHeading($l10n->t('Invitation canceled'), $l10n->t('Hello %s,', [$attendeeName])); |
| 441 | 441 | $template->addBodyText($l10n->t('The meeting »%1$s« with %2$s was canceled.', [$summary, $inviteeName])); |
| 442 | 442 | } else if ($method === self::METHOD_REPLY) { |
| 443 | - $template->setSubject('Re: ' . $summary); |
|
| 443 | + $template->setSubject('Re: '.$summary); |
|
| 444 | 444 | $template->addHeading($l10n->t('Invitation updated'), $l10n->t('Hello %s,', [$attendeeName])); |
| 445 | 445 | $template->addBodyText($l10n->t('The meeting »%1$s« with %2$s was updated.', [$summary, $inviteeName])); |
| 446 | 446 | } else { |
| 447 | - $template->setSubject('Invitation: ' . $summary); |
|
| 447 | + $template->setSubject('Invitation: '.$summary); |
|
| 448 | 448 | $template->addHeading($l10n->t('%1$s invited you to »%2$s«', [$inviteeName, $summary]), $l10n->t('Hello %s,', [$attendeeName])); |
| 449 | 449 | } |
| 450 | 450 | |
@@ -467,11 +467,11 @@ discard block |
||
| 467 | 467 | $this->getAbsoluteImagePath('filetypes/location.svg')); |
| 468 | 468 | } |
| 469 | 469 | if ($description) { |
| 470 | - $template->addBodyListItem((string)$description, $l10n->t('Description:'), |
|
| 470 | + $template->addBodyListItem((string) $description, $l10n->t('Description:'), |
|
| 471 | 471 | $this->getAbsoluteImagePath('filetypes/text.svg')); |
| 472 | 472 | } |
| 473 | 473 | if ($url) { |
| 474 | - $template->addBodyListItem((string)$url, $l10n->t('Link:'), |
|
| 474 | + $template->addBodyListItem((string) $url, $l10n->t('Link:'), |
|
| 475 | 475 | $this->getAbsoluteImagePath('filetypes/link.svg')); |
| 476 | 476 | } |
| 477 | 477 | } |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | * @return string |
| 525 | 525 | */ |
| 526 | 526 | private function createInvitationToken(Message $iTipMessage, $lastOccurrence):string { |
| 527 | - $token = $this->random->generate(60, ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_DIGITS); |
|
| 527 | + $token = $this->random->generate(60, ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_DIGITS); |
|
| 528 | 528 | |
| 529 | 529 | /** @var VEvent $vevent */ |
| 530 | 530 | $vevent = $iTipMessage->message->VEVENT; |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | if ($remoteShare) { |
| 215 | 215 | try { |
| 216 | 216 | $ownerCloudId = $this->cloudIdManager->getCloudId($remoteShare['owner'], $remoteShare['remote']); |
| 217 | - $shareId = $this->addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $ownerCloudId->getId(), $permissions, 'tmp_token_' . time(), $shareType); |
|
| 217 | + $shareId = $this->addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $ownerCloudId->getId(), $permissions, 'tmp_token_'.time(), $shareType); |
|
| 218 | 218 | $share->setId($shareId); |
| 219 | 219 | list($token, $remoteId) = $this->askOwnerToReShare($shareWith, $share, $shareId); |
| 220 | 220 | // remote share was create successfully if we get a valid token as return |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | $failure = true; |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | - if($failure) { |
|
| 299 | + if ($failure) { |
|
| 300 | 300 | $this->removeShareFromTableById($shareId); |
| 301 | 301 | $message_t = $this->l->t('Sharing %1$s failed, could not find %2$s, maybe the server is currently unreachable or uses a self-signed certificate.', |
| 302 | 302 | [$share->getNode()->getName(), $share->getSharedWith()]); |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | ->andWhere($query->expr()->eq('mountpoint', $query->createNamedParameter($share->getTarget()))); |
| 349 | 349 | $result = $query->execute()->fetchAll(); |
| 350 | 350 | |
| 351 | - if (isset($result[0]) && (int)$result[0]['remote_id'] > 0) { |
|
| 351 | + if (isset($result[0]) && (int) $result[0]['remote_id'] > 0) { |
|
| 352 | 352 | return $result[0]; |
| 353 | 353 | } |
| 354 | 354 | |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | $qb->execute(); |
| 392 | 392 | $id = $qb->getLastInsertId(); |
| 393 | 393 | |
| 394 | - return (int)$id; |
|
| 394 | + return (int) $id; |
|
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | /** |
@@ -481,14 +481,14 @@ discard block |
||
| 481 | 481 | public function getRemoteId(IShare $share) { |
| 482 | 482 | $query = $this->dbConnection->getQueryBuilder(); |
| 483 | 483 | $query->select('remote_id')->from('federated_reshares') |
| 484 | - ->where($query->expr()->eq('share_id', $query->createNamedParameter((int)$share->getId()))); |
|
| 484 | + ->where($query->expr()->eq('share_id', $query->createNamedParameter((int) $share->getId()))); |
|
| 485 | 485 | $data = $query->execute()->fetch(); |
| 486 | 486 | |
| 487 | 487 | if (!is_array($data) || !isset($data['remote_id'])) { |
| 488 | 488 | throw new ShareNotFound(); |
| 489 | 489 | } |
| 490 | 490 | |
| 491 | - return (int)$data['remote_id']; |
|
| 491 | + return (int) $data['remote_id']; |
|
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | /** |
@@ -519,7 +519,7 @@ discard block |
||
| 519 | 519 | ->orderBy('id'); |
| 520 | 520 | |
| 521 | 521 | $cursor = $qb->execute(); |
| 522 | - while($data = $cursor->fetch()) { |
|
| 522 | + while ($data = $cursor->fetch()) { |
|
| 523 | 523 | $children[] = $this->createShareObject($data); |
| 524 | 524 | } |
| 525 | 525 | $cursor->closeCursor(); |
@@ -641,7 +641,7 @@ discard block |
||
| 641 | 641 | ); |
| 642 | 642 | } |
| 643 | 643 | |
| 644 | - $qb->innerJoin('s', 'filecache' ,'f', $qb->expr()->eq('s.file_source', 'f.fileid')); |
|
| 644 | + $qb->innerJoin('s', 'filecache', 'f', $qb->expr()->eq('s.file_source', 'f.fileid')); |
|
| 645 | 645 | $qb->andWhere($qb->expr()->eq('f.parent', $qb->createNamedParameter($node->getId()))); |
| 646 | 646 | |
| 647 | 647 | $qb->orderBy('id'); |
@@ -704,7 +704,7 @@ discard block |
||
| 704 | 704 | |
| 705 | 705 | $cursor = $qb->execute(); |
| 706 | 706 | $shares = []; |
| 707 | - while($data = $cursor->fetch()) { |
|
| 707 | + while ($data = $cursor->fetch()) { |
|
| 708 | 708 | $shares[] = $this->createShareObject($data); |
| 709 | 709 | } |
| 710 | 710 | $cursor->closeCursor(); |
@@ -728,7 +728,7 @@ discard block |
||
| 728 | 728 | $cursor->closeCursor(); |
| 729 | 729 | |
| 730 | 730 | if ($data === false) { |
| 731 | - throw new ShareNotFound('Can not find share with ID: ' . $id); |
|
| 731 | + throw new ShareNotFound('Can not find share with ID: '.$id); |
|
| 732 | 732 | } |
| 733 | 733 | |
| 734 | 734 | try { |
@@ -757,7 +757,7 @@ discard block |
||
| 757 | 757 | ->execute(); |
| 758 | 758 | |
| 759 | 759 | $shares = []; |
| 760 | - while($data = $cursor->fetch()) { |
|
| 760 | + while ($data = $cursor->fetch()) { |
|
| 761 | 761 | $shares[] = $this->createShareObject($data); |
| 762 | 762 | } |
| 763 | 763 | $cursor->closeCursor(); |
@@ -796,7 +796,7 @@ discard block |
||
| 796 | 796 | |
| 797 | 797 | $cursor = $qb->execute(); |
| 798 | 798 | |
| 799 | - while($data = $cursor->fetch()) { |
|
| 799 | + while ($data = $cursor->fetch()) { |
|
| 800 | 800 | $shares[] = $this->createShareObject($data); |
| 801 | 801 | } |
| 802 | 802 | $cursor->closeCursor(); |
@@ -873,15 +873,15 @@ discard block |
||
| 873 | 873 | private function createShareObject($data) { |
| 874 | 874 | |
| 875 | 875 | $share = new Share($this->rootFolder, $this->userManager); |
| 876 | - $share->setId((int)$data['id']) |
|
| 877 | - ->setShareType((int)$data['share_type']) |
|
| 878 | - ->setPermissions((int)$data['permissions']) |
|
| 876 | + $share->setId((int) $data['id']) |
|
| 877 | + ->setShareType((int) $data['share_type']) |
|
| 878 | + ->setPermissions((int) $data['permissions']) |
|
| 879 | 879 | ->setTarget($data['file_target']) |
| 880 | - ->setMailSend((bool)$data['mail_send']) |
|
| 880 | + ->setMailSend((bool) $data['mail_send']) |
|
| 881 | 881 | ->setToken($data['token']); |
| 882 | 882 | |
| 883 | 883 | $shareTime = new \DateTime(); |
| 884 | - $shareTime->setTimestamp((int)$data['stime']); |
|
| 884 | + $shareTime->setTimestamp((int) $data['stime']); |
|
| 885 | 885 | $share->setShareTime($shareTime); |
| 886 | 886 | $share->setSharedWith($data['share_with']); |
| 887 | 887 | |
@@ -891,13 +891,13 @@ discard block |
||
| 891 | 891 | } else { |
| 892 | 892 | //OLD SHARE |
| 893 | 893 | $share->setSharedBy($data['uid_owner']); |
| 894 | - $path = $this->getNode($share->getSharedBy(), (int)$data['file_source']); |
|
| 894 | + $path = $this->getNode($share->getSharedBy(), (int) $data['file_source']); |
|
| 895 | 895 | |
| 896 | 896 | $owner = $path->getOwner(); |
| 897 | 897 | $share->setShareOwner($owner->getUID()); |
| 898 | 898 | } |
| 899 | 899 | |
| 900 | - $share->setNodeId((int)$data['file_source']); |
|
| 900 | + $share->setNodeId((int) $data['file_source']); |
|
| 901 | 901 | $share->setNodeType($data['item_type']); |
| 902 | 902 | |
| 903 | 903 | $share->setProviderId($this->identifier()); |
@@ -262,11 +262,11 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | public static function readData($user = null) { |
| 264 | 264 | if (isset($user)) { |
| 265 | - $jsonFile = \OC::$server->getUserManager()->get($user)->getHome() . '/mount.json'; |
|
| 265 | + $jsonFile = \OC::$server->getUserManager()->get($user)->getHome().'/mount.json'; |
|
| 266 | 266 | } else { |
| 267 | 267 | $config = \OC::$server->getConfig(); |
| 268 | - $datadir = $config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data/'); |
|
| 269 | - $jsonFile = $config->getSystemValue('mount_file', $datadir . '/mount.json'); |
|
| 268 | + $datadir = $config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data/'); |
|
| 269 | + $jsonFile = $config->getSystemValue('mount_file', $datadir.'/mount.json'); |
|
| 270 | 270 | } |
| 271 | 271 | if (is_file($jsonFile)) { |
| 272 | 272 | $mountPoints = json_decode(file_get_contents($jsonFile), true); |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | foreach ($backends as $backend) { |
| 293 | 293 | foreach ($backend->checkDependencies() as $dependency) { |
| 294 | 294 | if ($message = $dependency->getMessage()) { |
| 295 | - $message .= '<p>' . $message . '</p>'; |
|
| 295 | + $message .= '<p>'.$message.'</p>'; |
|
| 296 | 296 | } else { |
| 297 | 297 | $dependencyGroups[$dependency->getDependency()][] = $backend; |
| 298 | 298 | } |
@@ -301,9 +301,9 @@ discard block |
||
| 301 | 301 | |
| 302 | 302 | foreach ($dependencyGroups as $module => $dependants) { |
| 303 | 303 | $backends = implode(', ', array_map(function($backend) { |
| 304 | - return '"' . $backend->getText() . '"'; |
|
| 304 | + return '"'.$backend->getText().'"'; |
|
| 305 | 305 | }, $dependants)); |
| 306 | - $message .= '<p>' . OC_Mount_Config::getSingleDependencyMessage($l, $module, $backends) . '</p>'; |
|
| 306 | + $message .= '<p>'.OC_Mount_Config::getSingleDependencyMessage($l, $module, $backends).'</p>'; |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | return $message; |
@@ -320,11 +320,11 @@ discard block |
||
| 320 | 320 | private static function getSingleDependencyMessage(\OCP\IL10N $l, $module, $backend) { |
| 321 | 321 | switch (strtolower($module)) { |
| 322 | 322 | case 'curl': |
| 323 | - return (string)$l->t('The cURL support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', [$backend]); |
|
| 323 | + return (string) $l->t('The cURL support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', [$backend]); |
|
| 324 | 324 | case 'ftp': |
| 325 | - return (string)$l->t('The FTP support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', [$backend]); |
|
| 325 | + return (string) $l->t('The FTP support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', [$backend]); |
|
| 326 | 326 | default: |
| 327 | - return (string)$l->t('"%1$s" is not installed. Mounting of %2$s is not possible. Please ask your system administrator to install it.', [$module, $backend]); |
|
| 327 | + return (string) $l->t('"%1$s" is not installed. Mounting of %2$s is not possible. Please ask your system administrator to install it.', [$module, $backend]); |
|
| 328 | 328 | } |
| 329 | 329 | } |
| 330 | 330 | |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | $cipher = self::getCipher(); |
| 370 | 370 | $iv = \OC::$server->getSecureRandom()->generate(16); |
| 371 | 371 | $cipher->setIV($iv); |
| 372 | - return base64_encode($iv . $cipher->encrypt($password)); |
|
| 372 | + return base64_encode($iv.$cipher->encrypt($password)); |
|
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | /** |
@@ -211,10 +211,10 @@ discard block |
||
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | $passwordPolicy = $this->getPasswordPolicy(); |
| 214 | - $passwordCharset = ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_DIGITS; |
|
| 214 | + $passwordCharset = ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_DIGITS; |
|
| 215 | 215 | $passwordLength = 8; |
| 216 | 216 | if (!empty($passwordPolicy)) { |
| 217 | - $passwordLength = (int)$passwordPolicy['minLength'] > 0 ? (int)$passwordPolicy['minLength'] : $passwordLength; |
|
| 217 | + $passwordLength = (int) $passwordPolicy['minLength'] > 0 ? (int) $passwordPolicy['minLength'] : $passwordLength; |
|
| 218 | 218 | $passwordCharset .= $passwordPolicy['enforceSpecialCharacters'] ? ISecureRandom::CHAR_SYMBOLS : ''; |
| 219 | 219 | } |
| 220 | 220 | |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | $text = $this->l->t('%1$s shared »%2$s« with you.', [$initiatorDisplayName, $filename]); |
| 407 | 407 | |
| 408 | 408 | $emailTemplate->addBodyText( |
| 409 | - htmlspecialchars($text . ' ' . $this->l->t('Click the button below to open it.')), |
|
| 409 | + htmlspecialchars($text.' '.$this->l->t('Click the button below to open it.')), |
|
| 410 | 410 | $text |
| 411 | 411 | ); |
| 412 | 412 | $emailTemplate->addBodyButton( |
@@ -430,9 +430,9 @@ discard block |
||
| 430 | 430 | // The "Reply-To" is set to the sharer if an mail address is configured |
| 431 | 431 | // also the default footer contains a "Do not reply" which needs to be adjusted. |
| 432 | 432 | $initiatorEmail = $initiatorUser->getEMailAddress(); |
| 433 | - if($initiatorEmail !== null) { |
|
| 433 | + if ($initiatorEmail !== null) { |
|
| 434 | 434 | $message->setReplyTo([$initiatorEmail => $initiatorDisplayName]); |
| 435 | - $emailTemplate->addFooter($instanceName . ($this->defaults->getSlogan() !== '' ? ' - ' . $this->defaults->getSlogan() : '')); |
|
| 435 | + $emailTemplate->addFooter($instanceName.($this->defaults->getSlogan() !== '' ? ' - '.$this->defaults->getSlogan() : '')); |
|
| 436 | 436 | } else { |
| 437 | 437 | $emailTemplate->addFooter(); |
| 438 | 438 | } |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | $message->setFrom([\OCP\Util::getDefaultEmailAddress($instanceName) => $senderName]); |
| 495 | 495 | if ($initiatorEmailAddress !== null) { |
| 496 | 496 | $message->setReplyTo([$initiatorEmailAddress => $initiatorDisplayName]); |
| 497 | - $emailTemplate->addFooter($instanceName . ' - ' . $this->defaults->getSlogan()); |
|
| 497 | + $emailTemplate->addFooter($instanceName.' - '.$this->defaults->getSlogan()); |
|
| 498 | 498 | } else { |
| 499 | 499 | $emailTemplate->addFooter(); |
| 500 | 500 | } |
@@ -552,7 +552,7 @@ discard block |
||
| 552 | 552 | $message->setFrom([\OCP\Util::getDefaultEmailAddress($instanceName) => $senderName]); |
| 553 | 553 | if ($initiatorEmailAddress !== null) { |
| 554 | 554 | $message->setReplyTo([$initiatorEmailAddress => $initiatorDisplayName]); |
| 555 | - $emailTemplate->addFooter($instanceName . ' - ' . $this->defaults->getSlogan()); |
|
| 555 | + $emailTemplate->addFooter($instanceName.' - '.$this->defaults->getSlogan()); |
|
| 556 | 556 | } else { |
| 557 | 557 | $emailTemplate->addFooter(); |
| 558 | 558 | } |
@@ -645,7 +645,7 @@ discard block |
||
| 645 | 645 | ->orderBy('id'); |
| 646 | 646 | |
| 647 | 647 | $cursor = $qb->execute(); |
| 648 | - while($data = $cursor->fetch()) { |
|
| 648 | + while ($data = $cursor->fetch()) { |
|
| 649 | 649 | $children[] = $this->createShareObject($data); |
| 650 | 650 | } |
| 651 | 651 | $cursor->closeCursor(); |
@@ -692,7 +692,7 @@ discard block |
||
| 692 | 692 | $qb->execute(); |
| 693 | 693 | $id = $qb->getLastInsertId(); |
| 694 | 694 | |
| 695 | - return (int)$id; |
|
| 695 | + return (int) $id; |
|
| 696 | 696 | } |
| 697 | 697 | |
| 698 | 698 | /** |
@@ -709,7 +709,7 @@ discard block |
||
| 709 | 709 | // a real password was given |
| 710 | 710 | $validPassword = $plainTextPassword !== null && $plainTextPassword !== ''; |
| 711 | 711 | |
| 712 | - if($validPassword && ($originalShare->getPassword() !== $share->getPassword() || |
|
| 712 | + if ($validPassword && ($originalShare->getPassword() !== $share->getPassword() || |
|
| 713 | 713 | ($originalShare->getSendPasswordByTalk() && !$share->getSendPasswordByTalk()))) { |
| 714 | 714 | $this->sendPassword($share, $plainTextPassword); |
| 715 | 715 | } |
@@ -813,7 +813,7 @@ discard block |
||
| 813 | 813 | |
| 814 | 814 | $cursor = $qb->execute(); |
| 815 | 815 | $shares = []; |
| 816 | - while($data = $cursor->fetch()) { |
|
| 816 | + while ($data = $cursor->fetch()) { |
|
| 817 | 817 | $shares[] = $this->createShareObject($data); |
| 818 | 818 | } |
| 819 | 819 | $cursor->closeCursor(); |
@@ -865,7 +865,7 @@ discard block |
||
| 865 | 865 | ->execute(); |
| 866 | 866 | |
| 867 | 867 | $shares = []; |
| 868 | - while($data = $cursor->fetch()) { |
|
| 868 | + while ($data = $cursor->fetch()) { |
|
| 869 | 869 | $shares[] = $this->createShareObject($data); |
| 870 | 870 | } |
| 871 | 871 | $cursor->closeCursor(); |
@@ -904,7 +904,7 @@ discard block |
||
| 904 | 904 | |
| 905 | 905 | $cursor = $qb->execute(); |
| 906 | 906 | |
| 907 | - while($data = $cursor->fetch()) { |
|
| 907 | + while ($data = $cursor->fetch()) { |
|
| 908 | 908 | $shares[] = $this->createShareObject($data); |
| 909 | 909 | } |
| 910 | 910 | $cursor->closeCursor(); |
@@ -967,16 +967,16 @@ discard block |
||
| 967 | 967 | protected function createShareObject($data) { |
| 968 | 968 | |
| 969 | 969 | $share = new Share($this->rootFolder, $this->userManager); |
| 970 | - $share->setId((int)$data['id']) |
|
| 971 | - ->setShareType((int)$data['share_type']) |
|
| 972 | - ->setPermissions((int)$data['permissions']) |
|
| 970 | + $share->setId((int) $data['id']) |
|
| 971 | + ->setShareType((int) $data['share_type']) |
|
| 972 | + ->setPermissions((int) $data['permissions']) |
|
| 973 | 973 | ->setTarget($data['file_target']) |
| 974 | - ->setMailSend((bool)$data['mail_send']) |
|
| 974 | + ->setMailSend((bool) $data['mail_send']) |
|
| 975 | 975 | ->setNote($data['note']) |
| 976 | 976 | ->setToken($data['token']); |
| 977 | 977 | |
| 978 | 978 | $shareTime = new \DateTime(); |
| 979 | - $shareTime->setTimestamp((int)$data['stime']); |
|
| 979 | + $shareTime->setTimestamp((int) $data['stime']); |
|
| 980 | 980 | $share->setShareTime($shareTime); |
| 981 | 981 | $share->setSharedWith($data['share_with']); |
| 982 | 982 | $share->setPassword($data['password']); |
@@ -988,7 +988,7 @@ discard block |
||
| 988 | 988 | } else { |
| 989 | 989 | //OLD SHARE |
| 990 | 990 | $share->setSharedBy($data['uid_owner']); |
| 991 | - $path = $this->getNode($share->getSharedBy(), (int)$data['file_source']); |
|
| 991 | + $path = $this->getNode($share->getSharedBy(), (int) $data['file_source']); |
|
| 992 | 992 | |
| 993 | 993 | $owner = $path->getOwner(); |
| 994 | 994 | $share->setShareOwner($owner->getUID()); |
@@ -1001,7 +1001,7 @@ discard block |
||
| 1001 | 1001 | } |
| 1002 | 1002 | } |
| 1003 | 1003 | |
| 1004 | - $share->setNodeId((int)$data['file_source']); |
|
| 1004 | + $share->setNodeId((int) $data['file_source']); |
|
| 1005 | 1005 | $share->setNodeType($data['item_type']); |
| 1006 | 1006 | |
| 1007 | 1007 | $share->setProviderId($this->identifier()); |
@@ -1118,7 +1118,7 @@ discard block |
||
| 1118 | 1118 | ); |
| 1119 | 1119 | } |
| 1120 | 1120 | |
| 1121 | - $qb->innerJoin('s', 'filecache' ,'f', $qb->expr()->eq('s.file_source', 'f.fileid')); |
|
| 1121 | + $qb->innerJoin('s', 'filecache', 'f', $qb->expr()->eq('s.file_source', 'f.fileid')); |
|
| 1122 | 1122 | $qb->andWhere($qb->expr()->eq('f.parent', $qb->createNamedParameter($node->getId()))); |
| 1123 | 1123 | |
| 1124 | 1124 | $qb->orderBy('id'); |
@@ -231,14 +231,14 @@ discard block |
||
| 231 | 231 | |
| 232 | 232 | $result['share_with_displayname'] = $share->getSharedWithDisplayName(); |
| 233 | 233 | if (empty($result['share_with_displayname'])) { |
| 234 | - $displayNameLength = ($hasCircleId? strrpos($share->getSharedWith(), ' '): strlen($share->getSharedWith())); |
|
| 234 | + $displayNameLength = ($hasCircleId ? strrpos($share->getSharedWith(), ' ') : strlen($share->getSharedWith())); |
|
| 235 | 235 | $result['share_with_displayname'] = substr($share->getSharedWith(), 0, $displayNameLength); |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | $result['share_with_avatar'] = $share->getSharedWithAvatar(); |
| 239 | 239 | |
| 240 | - $shareWithStart = ($hasCircleId? strrpos($share->getSharedWith(), '[') + 1: 0); |
|
| 241 | - $shareWithLength = ($hasCircleId? -1: strpos($share->getSharedWith(), ' ')); |
|
| 240 | + $shareWithStart = ($hasCircleId ? strrpos($share->getSharedWith(), '[') + 1 : 0); |
|
| 241 | + $shareWithLength = ($hasCircleId ? -1 : strpos($share->getSharedWith(), ' ')); |
|
| 242 | 242 | $result['share_with'] = substr($share->getSharedWith(), $shareWithStart, $shareWithLength); |
| 243 | 243 | } else if ($share->getShareType() === Share::SHARE_TYPE_ROOM) { |
| 244 | 244 | $result['share_with'] = $share->getSharedWith(); |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | // FIXME: If we inject the contacts manager it gets initialized bofore any address books are registered |
| 269 | 269 | $result = \OC::$server->getContactsManager()->search($query, [$property]); |
| 270 | 270 | foreach ($result as $r) { |
| 271 | - foreach($r[$property] as $value) { |
|
| 271 | + foreach ($r[$property] as $value) { |
|
| 272 | 272 | if ($value === $query) { |
| 273 | 273 | return $r['FN']; |
| 274 | 274 | } |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | |
| 499 | 499 | $share->setSharedWith($shareWith); |
| 500 | 500 | $share->setPermissions($permissions); |
| 501 | - } else if ($shareType === Share::SHARE_TYPE_REMOTE_GROUP) { |
|
| 501 | + } else if ($shareType === Share::SHARE_TYPE_REMOTE_GROUP) { |
|
| 502 | 502 | if (!$this->shareManager->outgoingServer2ServerGroupSharesAllowed()) { |
| 503 | 503 | throw new OCSForbiddenException($this->l->t('Sharing %1$s failed because the back end does not allow shares from type %2$s', [$path->getPath(), $shareType])); |
| 504 | 504 | } |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | |
| 575 | 575 | $shares = array_merge($userShares, $groupShares, $circleShares, $roomShares); |
| 576 | 576 | |
| 577 | - $shares = array_filter($shares, function (IShare $share) { |
|
| 577 | + $shares = array_filter($shares, function(IShare $share) { |
|
| 578 | 578 | return $share->getShareOwner() !== $this->currentUser; |
| 579 | 579 | }); |
| 580 | 580 | |
@@ -613,7 +613,7 @@ discard block |
||
| 613 | 613 | $shares = array_merge($shares, $this->shareManager->getSharesBy($this->currentUser, Share::SHARE_TYPE_USER, $node, false, -1, 0)); |
| 614 | 614 | $shares = array_merge($shares, $this->shareManager->getSharesBy($this->currentUser, Share::SHARE_TYPE_GROUP, $node, false, -1, 0)); |
| 615 | 615 | $shares = array_merge($shares, $this->shareManager->getSharesBy($this->currentUser, Share::SHARE_TYPE_LINK, $node, false, -1, 0)); |
| 616 | - if($this->shareManager->shareProviderExists(Share::SHARE_TYPE_EMAIL)) { |
|
| 616 | + if ($this->shareManager->shareProviderExists(Share::SHARE_TYPE_EMAIL)) { |
|
| 617 | 617 | $shares = array_merge($shares, $this->shareManager->getSharesBy($this->currentUser, Share::SHARE_TYPE_EMAIL, $node, false, -1, 0)); |
| 618 | 618 | } |
| 619 | 619 | if ($this->shareManager->outgoingServer2ServerSharesAllowed()) { |
@@ -777,7 +777,7 @@ discard block |
||
| 777 | 777 | throw new OCSBadRequestException($this->l->t('Wrong or no update parameter given')); |
| 778 | 778 | } |
| 779 | 779 | |
| 780 | - if($note !== null) { |
|
| 780 | + if ($note !== null) { |
|
| 781 | 781 | $share->setNote($note); |
| 782 | 782 | } |
| 783 | 783 | |
@@ -794,7 +794,7 @@ discard block |
||
| 794 | 794 | } |
| 795 | 795 | |
| 796 | 796 | if ($permissions !== null) { |
| 797 | - $newPermissions = (int)$permissions; |
|
| 797 | + $newPermissions = (int) $permissions; |
|
| 798 | 798 | $newPermissions = $newPermissions & ~Constants::PERMISSION_SHARE; |
| 799 | 799 | } |
| 800 | 800 | |
@@ -852,7 +852,7 @@ discard block |
||
| 852 | 852 | |
| 853 | 853 | } else { |
| 854 | 854 | if ($permissions !== null) { |
| 855 | - $permissions = (int)$permissions; |
|
| 855 | + $permissions = (int) $permissions; |
|
| 856 | 856 | $share->setPermissions($permissions); |
| 857 | 857 | } |
| 858 | 858 | |
@@ -1002,7 +1002,7 @@ discard block |
||
| 1002 | 1002 | |
| 1003 | 1003 | // First check if it is an internal share. |
| 1004 | 1004 | try { |
| 1005 | - $share = $this->shareManager->getShareById('ocinternal:' . $id, $this->currentUser); |
|
| 1005 | + $share = $this->shareManager->getShareById('ocinternal:'.$id, $this->currentUser); |
|
| 1006 | 1006 | return $share; |
| 1007 | 1007 | } catch (ShareNotFound $e) { |
| 1008 | 1008 | // Do nothing, just try the other share type |
@@ -1011,7 +1011,7 @@ discard block |
||
| 1011 | 1011 | |
| 1012 | 1012 | try { |
| 1013 | 1013 | if ($this->shareManager->shareProviderExists(Share::SHARE_TYPE_CIRCLE)) { |
| 1014 | - $share = $this->shareManager->getShareById('ocCircleShare:' . $id, $this->currentUser); |
|
| 1014 | + $share = $this->shareManager->getShareById('ocCircleShare:'.$id, $this->currentUser); |
|
| 1015 | 1015 | return $share; |
| 1016 | 1016 | } |
| 1017 | 1017 | } catch (ShareNotFound $e) { |
@@ -1020,7 +1020,7 @@ discard block |
||
| 1020 | 1020 | |
| 1021 | 1021 | try { |
| 1022 | 1022 | if ($this->shareManager->shareProviderExists(Share::SHARE_TYPE_EMAIL)) { |
| 1023 | - $share = $this->shareManager->getShareById('ocMailShare:' . $id, $this->currentUser); |
|
| 1023 | + $share = $this->shareManager->getShareById('ocMailShare:'.$id, $this->currentUser); |
|
| 1024 | 1024 | return $share; |
| 1025 | 1025 | } |
| 1026 | 1026 | } catch (ShareNotFound $e) { |
@@ -1028,7 +1028,7 @@ discard block |
||
| 1028 | 1028 | } |
| 1029 | 1029 | |
| 1030 | 1030 | try { |
| 1031 | - $share = $this->shareManager->getShareById('ocRoomShare:' . $id, $this->currentUser); |
|
| 1031 | + $share = $this->shareManager->getShareById('ocRoomShare:'.$id, $this->currentUser); |
|
| 1032 | 1032 | return $share; |
| 1033 | 1033 | } catch (ShareNotFound $e) { |
| 1034 | 1034 | // Do nothing, just try the other share type |
@@ -1037,7 +1037,7 @@ discard block |
||
| 1037 | 1037 | if (!$this->shareManager->outgoingServer2ServerSharesAllowed()) { |
| 1038 | 1038 | throw new ShareNotFound(); |
| 1039 | 1039 | } |
| 1040 | - $share = $this->shareManager->getShareById('ocFederatedSharing:' . $id, $this->currentUser); |
|
| 1040 | + $share = $this->shareManager->getShareById('ocFederatedSharing:'.$id, $this->currentUser); |
|
| 1041 | 1041 | |
| 1042 | 1042 | return $share; |
| 1043 | 1043 | } |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | */ |
| 43 | 43 | public function __construct($newProviderId, $existingProviderName) { |
| 44 | 44 | $l = \OC::$server->getL10N('federation'); |
| 45 | - $message = 'ID "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"'; |
|
| 45 | + $message = 'ID "'.$newProviderId.'" already used by cloud federation provider "'.$existingProviderName.'"'; |
|
| 46 | 46 | $hint = $l->t('ID "%1$s" already used by cloud federation provider "%2$s"', [$newProviderId, $existingProviderName]); |
| 47 | 47 | parent::__construct($message, $hint); |
| 48 | 48 | } |
@@ -140,19 +140,19 @@ discard block |
||
| 140 | 140 | if (isset($dependencies['php']['@attributes']['min-version'])) { |
| 141 | 141 | $minVersion = $dependencies['php']['@attributes']['min-version']; |
| 142 | 142 | if ($this->compareSmaller($this->platform->getPhpVersion(), $minVersion)) { |
| 143 | - $missing[] = (string)$this->l->t('PHP %s or higher is required.', [$minVersion]); |
|
| 143 | + $missing[] = (string) $this->l->t('PHP %s or higher is required.', [$minVersion]); |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | if (isset($dependencies['php']['@attributes']['max-version'])) { |
| 147 | 147 | $maxVersion = $dependencies['php']['@attributes']['max-version']; |
| 148 | 148 | if ($this->compareBigger($this->platform->getPhpVersion(), $maxVersion)) { |
| 149 | - $missing[] = (string)$this->l->t('PHP with a version lower than %s is required.', [$maxVersion]); |
|
| 149 | + $missing[] = (string) $this->l->t('PHP with a version lower than %s is required.', [$maxVersion]); |
|
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | if (isset($dependencies['php']['@attributes']['min-int-size'])) { |
| 153 | 153 | $intSize = $dependencies['php']['@attributes']['min-int-size']; |
| 154 | - if ($intSize > $this->platform->getIntSize()*8) { |
|
| 155 | - $missing[] = (string)$this->l->t('%sbit or higher PHP required.', [$intSize]); |
|
| 154 | + if ($intSize > $this->platform->getIntSize() * 8) { |
|
| 155 | + $missing[] = (string) $this->l->t('%sbit or higher PHP required.', [$intSize]); |
|
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | return $missing; |
@@ -175,12 +175,12 @@ discard block |
||
| 175 | 175 | if (!is_array($supportedDatabases)) { |
| 176 | 176 | $supportedDatabases = array($supportedDatabases); |
| 177 | 177 | } |
| 178 | - $supportedDatabases = array_map(function ($db) { |
|
| 178 | + $supportedDatabases = array_map(function($db) { |
|
| 179 | 179 | return $this->getValue($db); |
| 180 | 180 | }, $supportedDatabases); |
| 181 | 181 | $currentDatabase = $this->platform->getDatabase(); |
| 182 | 182 | if (!in_array($currentDatabase, $supportedDatabases)) { |
| 183 | - $missing[] = (string)$this->l->t('Following databases are supported: %s', [implode(', ', $supportedDatabases)]); |
|
| 183 | + $missing[] = (string) $this->l->t('Following databases are supported: %s', [implode(', ', $supportedDatabases)]); |
|
| 184 | 184 | } |
| 185 | 185 | return $missing; |
| 186 | 186 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | } |
| 210 | 210 | $commandName = $this->getValue($command); |
| 211 | 211 | if (!$this->platform->isCommandKnown($commandName)) { |
| 212 | - $missing[] = (string)$this->l->t('The command line tool %s could not be found', [$commandName]); |
|
| 212 | + $missing[] = (string) $this->l->t('The command line tool %s could not be found', [$commandName]); |
|
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | 215 | return $missing; |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | return $missing; |
| 276 | 276 | } |
| 277 | 277 | if (is_array($oss)) { |
| 278 | - $oss = array_map(function ($os) { |
|
| 278 | + $oss = array_map(function($os) { |
|
| 279 | 279 | return $this->getValue($os); |
| 280 | 280 | }, $oss); |
| 281 | 281 | } else { |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | } |
| 284 | 284 | $currentOS = $this->platform->getOS(); |
| 285 | 285 | if (!in_array($currentOS, $oss)) { |
| 286 | - $missing[] = (string)$this->l->t('Following platforms are supported: %s', [implode(', ', $oss)]); |
|
| 286 | + $missing[] = (string) $this->l->t('Following platforms are supported: %s', [implode(', ', $oss)]); |
|
| 287 | 287 | } |
| 288 | 288 | return $missing; |
| 289 | 289 | } |
@@ -316,12 +316,12 @@ discard block |
||
| 316 | 316 | |
| 317 | 317 | if (!is_null($minVersion)) { |
| 318 | 318 | if ($this->compareSmaller($this->platform->getOcVersion(), $minVersion)) { |
| 319 | - $missing[] = (string)$this->l->t('Server version %s or higher is required.', [$this->toVisibleVersion($minVersion)]); |
|
| 319 | + $missing[] = (string) $this->l->t('Server version %s or higher is required.', [$this->toVisibleVersion($minVersion)]); |
|
| 320 | 320 | } |
| 321 | 321 | } |
| 322 | 322 | if (!is_null($maxVersion)) { |
| 323 | 323 | if ($this->compareBigger($this->platform->getOcVersion(), $maxVersion)) { |
| 324 | - $missing[] = (string)$this->l->t('Server version %s or lower is required.', [$this->toVisibleVersion($maxVersion)]); |
|
| 324 | + $missing[] = (string) $this->l->t('Server version %s or lower is required.', [$this->toVisibleVersion($maxVersion)]); |
|
| 325 | 325 | } |
| 326 | 326 | } |
| 327 | 327 | return $missing; |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | return '10'; |
| 340 | 340 | default: |
| 341 | 341 | if (strpos($version, '9.1.') === 0) { |
| 342 | - $version = '10.0.' . substr($version, 4); |
|
| 342 | + $version = '10.0.'.substr($version, 4); |
|
| 343 | 343 | } |
| 344 | 344 | return $version; |
| 345 | 345 | } |
@@ -353,6 +353,6 @@ discard block |
||
| 353 | 353 | if (isset($element['@value'])) { |
| 354 | 354 | return $element['@value']; |
| 355 | 355 | } |
| 356 | - return (string)$element; |
|
| 356 | + return (string) $element; |
|
| 357 | 357 | } |
| 358 | 358 | } |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | if ($share->getSharedWith() === null) { |
| 227 | 227 | throw new \InvalidArgumentException('SharedWith should not be empty'); |
| 228 | 228 | } |
| 229 | - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_REMOTE_GROUP) { |
|
| 229 | + } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_REMOTE_GROUP) { |
|
| 230 | 230 | if ($share->getSharedWith() === null) { |
| 231 | 231 | throw new \InvalidArgumentException('SharedWith should not be empty'); |
| 232 | 232 | } |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | |
| 363 | 363 | if ($fullId === null && $expirationDate === null && $this->shareApiLinkDefaultExpireDate()) { |
| 364 | 364 | $expirationDate = new \DateTime(); |
| 365 | - $expirationDate->setTime(0,0,0); |
|
| 365 | + $expirationDate->setTime(0, 0, 0); |
|
| 366 | 366 | $expirationDate->add(new \DateInterval('P'.$this->shareApiLinkDefaultExpireDays().'D')); |
| 367 | 367 | } |
| 368 | 368 | |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | |
| 375 | 375 | $date = new \DateTime(); |
| 376 | 376 | $date->setTime(0, 0, 0); |
| 377 | - $date->add(new \DateInterval('P' . $this->shareApiLinkDefaultExpireDays() . 'D')); |
|
| 377 | + $date->add(new \DateInterval('P'.$this->shareApiLinkDefaultExpireDays().'D')); |
|
| 378 | 378 | if ($date < $expirationDate) { |
| 379 | 379 | $message = $this->l->t('Can’t set expiration date more than %s days in the future', [$this->shareApiLinkDefaultExpireDays()]); |
| 380 | 380 | throw new GenericShareException($message, $message, 404); |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | */ |
| 428 | 428 | $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_USER); |
| 429 | 429 | $existingShares = $provider->getSharesByPath($share->getNode()); |
| 430 | - foreach($existingShares as $existingShare) { |
|
| 430 | + foreach ($existingShares as $existingShare) { |
|
| 431 | 431 | // Ignore if it is the same share |
| 432 | 432 | try { |
| 433 | 433 | if ($existingShare->getFullId() === $share->getFullId()) { |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | */ |
| 485 | 485 | $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_GROUP); |
| 486 | 486 | $existingShares = $provider->getSharesByPath($share->getNode()); |
| 487 | - foreach($existingShares as $existingShare) { |
|
| 487 | + foreach ($existingShares as $existingShare) { |
|
| 488 | 488 | try { |
| 489 | 489 | if ($existingShare->getFullId() === $share->getFullId()) { |
| 490 | 490 | continue; |
@@ -553,7 +553,7 @@ discard block |
||
| 553 | 553 | // Make sure that we do not share a path that contains a shared mountpoint |
| 554 | 554 | if ($path instanceof \OCP\Files\Folder) { |
| 555 | 555 | $mounts = $this->mountManager->findIn($path->getPath()); |
| 556 | - foreach($mounts as $mount) { |
|
| 556 | + foreach ($mounts as $mount) { |
|
| 557 | 557 | if ($mount->getStorage()->instanceOfStorage('\OCA\Files_Sharing\ISharedStorage')) { |
| 558 | 558 | throw new \InvalidArgumentException('Path contains files shared with you'); |
| 559 | 559 | } |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | $storage = $share->getNode()->getStorage(); |
| 602 | 602 | if ($storage->instanceOfStorage('OCA\Files_Sharing\External\Storage')) { |
| 603 | 603 | $parent = $share->getNode()->getParent(); |
| 604 | - while($parent->getStorage()->instanceOfStorage('OCA\Files_Sharing\External\Storage')) { |
|
| 604 | + while ($parent->getStorage()->instanceOfStorage('OCA\Files_Sharing\External\Storage')) { |
|
| 605 | 605 | $parent = $parent->getParent(); |
| 606 | 606 | } |
| 607 | 607 | $share->setShareOwner($parent->getOwner()->getUID()); |
@@ -654,7 +654,7 @@ discard block |
||
| 654 | 654 | } |
| 655 | 655 | |
| 656 | 656 | // Generate the target |
| 657 | - $target = $this->config->getSystemValue('share_folder', '/') .'/'. $share->getNode()->getName(); |
|
| 657 | + $target = $this->config->getSystemValue('share_folder', '/').'/'.$share->getNode()->getName(); |
|
| 658 | 658 | $target = \OC\Files\Filesystem::normalizePath($target); |
| 659 | 659 | $share->setTarget($target); |
| 660 | 660 | |
@@ -677,7 +677,7 @@ discard block |
||
| 677 | 677 | |
| 678 | 678 | if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) { |
| 679 | 679 | $mailSend = $share->getMailSend(); |
| 680 | - if($mailSend === true) { |
|
| 680 | + if ($mailSend === true) { |
|
| 681 | 681 | $user = $this->userManager->get($share->getSharedWith()); |
| 682 | 682 | if ($user !== null) { |
| 683 | 683 | $emailAddress = $user->getEMailAddress(); |
@@ -692,12 +692,12 @@ discard block |
||
| 692 | 692 | $emailAddress, |
| 693 | 693 | $share->getExpirationDate() |
| 694 | 694 | ); |
| 695 | - $this->logger->debug('Send share notification to ' . $emailAddress . ' for share with ID ' . $share->getId(), ['app' => 'share']); |
|
| 695 | + $this->logger->debug('Send share notification to '.$emailAddress.' for share with ID '.$share->getId(), ['app' => 'share']); |
|
| 696 | 696 | } else { |
| 697 | - $this->logger->debug('Share notification not send to ' . $share->getSharedWith() . ' because email address is not set.', ['app' => 'share']); |
|
| 697 | + $this->logger->debug('Share notification not send to '.$share->getSharedWith().' because email address is not set.', ['app' => 'share']); |
|
| 698 | 698 | } |
| 699 | 699 | } else { |
| 700 | - $this->logger->debug('Share notification not send to ' . $share->getSharedWith() . ' because user could not be found.', ['app' => 'share']); |
|
| 700 | + $this->logger->debug('Share notification not send to '.$share->getSharedWith().' because user could not be found.', ['app' => 'share']); |
|
| 701 | 701 | } |
| 702 | 702 | } else { |
| 703 | 703 | $this->logger->debug('Share notification not send because mailsend is false.', ['app' => 'share']); |
@@ -741,7 +741,7 @@ discard block |
||
| 741 | 741 | $text = $l->t('%1$s shared »%2$s« with you.', [$initiatorDisplayName, $filename]); |
| 742 | 742 | |
| 743 | 743 | $emailTemplate->addBodyText( |
| 744 | - htmlspecialchars($text . ' ' . $l->t('Click the button below to open it.')), |
|
| 744 | + htmlspecialchars($text.' '.$l->t('Click the button below to open it.')), |
|
| 745 | 745 | $text |
| 746 | 746 | ); |
| 747 | 747 | $emailTemplate->addBodyButton( |
@@ -765,9 +765,9 @@ discard block |
||
| 765 | 765 | // The "Reply-To" is set to the sharer if an mail address is configured |
| 766 | 766 | // also the default footer contains a "Do not reply" which needs to be adjusted. |
| 767 | 767 | $initiatorEmail = $initiatorUser->getEMailAddress(); |
| 768 | - if($initiatorEmail !== null) { |
|
| 768 | + if ($initiatorEmail !== null) { |
|
| 769 | 769 | $message->setReplyTo([$initiatorEmail => $initiatorDisplayName]); |
| 770 | - $emailTemplate->addFooter($instanceName . ($this->defaults->getSlogan() !== '' ? ' - ' . $this->defaults->getSlogan() : '')); |
|
| 770 | + $emailTemplate->addFooter($instanceName.($this->defaults->getSlogan() !== '' ? ' - '.$this->defaults->getSlogan() : '')); |
|
| 771 | 771 | } else { |
| 772 | 772 | $emailTemplate->addFooter(); |
| 773 | 773 | } |
@@ -986,7 +986,7 @@ discard block |
||
| 986 | 986 | * @param string $recipientId |
| 987 | 987 | */ |
| 988 | 988 | public function deleteFromSelf(\OCP\Share\IShare $share, $recipientId) { |
| 989 | - list($providerId, ) = $this->splitFullId($share->getFullId()); |
|
| 989 | + list($providerId,) = $this->splitFullId($share->getFullId()); |
|
| 990 | 990 | $provider = $this->factory->getProvider($providerId); |
| 991 | 991 | |
| 992 | 992 | $provider->deleteFromSelf($share, $recipientId); |
@@ -995,7 +995,7 @@ discard block |
||
| 995 | 995 | } |
| 996 | 996 | |
| 997 | 997 | public function restoreShare(IShare $share, string $recipientId): IShare { |
| 998 | - list($providerId, ) = $this->splitFullId($share->getFullId()); |
|
| 998 | + list($providerId,) = $this->splitFullId($share->getFullId()); |
|
| 999 | 999 | $provider = $this->factory->getProvider($providerId); |
| 1000 | 1000 | |
| 1001 | 1001 | return $provider->restore($share, $recipientId); |
@@ -1016,7 +1016,7 @@ discard block |
||
| 1016 | 1016 | if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { |
| 1017 | 1017 | $sharedWith = $this->groupManager->get($share->getSharedWith()); |
| 1018 | 1018 | if (is_null($sharedWith)) { |
| 1019 | - throw new \InvalidArgumentException('Group "' . $share->getSharedWith() . '" does not exist'); |
|
| 1019 | + throw new \InvalidArgumentException('Group "'.$share->getSharedWith().'" does not exist'); |
|
| 1020 | 1020 | } |
| 1021 | 1021 | $recipient = $this->userManager->get($recipientId); |
| 1022 | 1022 | if (!$sharedWith->inGroup($recipient)) { |
@@ -1024,7 +1024,7 @@ discard block |
||
| 1024 | 1024 | } |
| 1025 | 1025 | } |
| 1026 | 1026 | |
| 1027 | - list($providerId, ) = $this->splitFullId($share->getFullId()); |
|
| 1027 | + list($providerId,) = $this->splitFullId($share->getFullId()); |
|
| 1028 | 1028 | $provider = $this->factory->getProvider($providerId); |
| 1029 | 1029 | |
| 1030 | 1030 | $provider->move($share, $recipientId); |
@@ -1071,7 +1071,7 @@ discard block |
||
| 1071 | 1071 | |
| 1072 | 1072 | $shares2 = []; |
| 1073 | 1073 | |
| 1074 | - while(true) { |
|
| 1074 | + while (true) { |
|
| 1075 | 1075 | $added = 0; |
| 1076 | 1076 | foreach ($shares as $share) { |
| 1077 | 1077 | |
@@ -1156,7 +1156,7 @@ discard block |
||
| 1156 | 1156 | }); |
| 1157 | 1157 | |
| 1158 | 1158 | // Only get shares where the owner still exists |
| 1159 | - $shares = array_filter($shares, function (IShare $share) { |
|
| 1159 | + $shares = array_filter($shares, function(IShare $share) { |
|
| 1160 | 1160 | return $this->userManager->userExists($share->getShareOwner()); |
| 1161 | 1161 | }); |
| 1162 | 1162 | |
@@ -1195,7 +1195,7 @@ discard block |
||
| 1195 | 1195 | * |
| 1196 | 1196 | * @return Share[] |
| 1197 | 1197 | */ |
| 1198 | - public function getSharesByPath(\OCP\Files\Node $path, $page=0, $perPage=50) { |
|
| 1198 | + public function getSharesByPath(\OCP\Files\Node $path, $page = 0, $perPage = 50) { |
|
| 1199 | 1199 | return []; |
| 1200 | 1200 | } |
| 1201 | 1201 | |
@@ -1214,7 +1214,7 @@ discard block |
||
| 1214 | 1214 | } |
| 1215 | 1215 | $share = null; |
| 1216 | 1216 | try { |
| 1217 | - if($this->shareApiAllowLinks()) { |
|
| 1217 | + if ($this->shareApiAllowLinks()) { |
|
| 1218 | 1218 | $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_LINK); |
| 1219 | 1219 | $share = $provider->getShareByToken($token); |
| 1220 | 1220 | } |
@@ -1430,7 +1430,7 @@ discard block |
||
| 1430 | 1430 | } |
| 1431 | 1431 | $al['users'][$owner] = [ |
| 1432 | 1432 | 'node_id' => $path->getId(), |
| 1433 | - 'node_path' => '/' . $ownerPath, |
|
| 1433 | + 'node_path' => '/'.$ownerPath, |
|
| 1434 | 1434 | ]; |
| 1435 | 1435 | } else { |
| 1436 | 1436 | $al['users'][] = $owner; |
@@ -1530,7 +1530,7 @@ discard block |
||
| 1530 | 1530 | * @return int |
| 1531 | 1531 | */ |
| 1532 | 1532 | public function shareApiLinkDefaultExpireDays() { |
| 1533 | - return (int)$this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
| 1533 | + return (int) $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
| 1534 | 1534 | } |
| 1535 | 1535 | |
| 1536 | 1536 | /** |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | 'collectionOf' => $collectionOf, |
| 85 | 85 | 'supportedFileExtensions' => $supportedFileExtensions |
| 86 | 86 | ); |
| 87 | - if(count(self::$backendTypes) === 1) { |
|
| 87 | + if (count(self::$backendTypes) === 1) { |
|
| 88 | 88 | Util::addScript('core', 'merged-share-backend'); |
| 89 | 89 | } |
| 90 | 90 | return true; |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | $select = self::createSelectStatement(self::FORMAT_NONE, $fileDependent); |
| 156 | 156 | |
| 157 | - $where .= ' `' . $column . '` = ? AND `item_type` = ? '; |
|
| 157 | + $where .= ' `'.$column.'` = ? AND `item_type` = ? '; |
|
| 158 | 158 | $arguments = array($itemSource, $itemType); |
| 159 | 159 | // for link shares $user === null |
| 160 | 160 | if ($user !== null) { |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | $arguments[] = $owner; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - $query = \OC_DB::prepare('SELECT ' . $select . ' FROM `*PREFIX*share` '. $fileDependentWhere . $where); |
|
| 175 | + $query = \OC_DB::prepare('SELECT '.$select.' FROM `*PREFIX*share` '.$fileDependentWhere.$where); |
|
| 176 | 176 | |
| 177 | 177 | $result = \OC_DB::executeAudited($query, $arguments); |
| 178 | 178 | |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | if ($fileDependent && !self::isFileReachable($row['path'], $row['storage_id'])) { |
| 181 | 181 | continue; |
| 182 | 182 | } |
| 183 | - if ($fileDependent && (int)$row['file_parent'] === -1) { |
|
| 183 | + if ($fileDependent && (int) $row['file_parent'] === -1) { |
|
| 184 | 184 | // if it is a mount point we need to get the path from the mount manager |
| 185 | 185 | $mountManager = \OC\Files\Filesystem::getMountManager(); |
| 186 | 186 | $mountPoint = $mountManager->findByStorageId($row['storage_id']); |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | $row['path'] = $path; |
| 192 | 192 | } else { |
| 193 | 193 | \OC::$server->getLogger()->warning( |
| 194 | - 'Could not resolve mount point for ' . $row['storage_id'], |
|
| 194 | + 'Could not resolve mount point for '.$row['storage_id'], |
|
| 195 | 195 | ['app' => 'OCP\Share'] |
| 196 | 196 | ); |
| 197 | 197 | } |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | //if didn't found a result than let's look for a group share. |
| 203 | - if(empty($shares) && $user !== null) { |
|
| 203 | + if (empty($shares) && $user !== null) { |
|
| 204 | 204 | $userObject = \OC::$server->getUserManager()->get($user); |
| 205 | 205 | $groups = []; |
| 206 | 206 | if ($userObject) { |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | if (!empty($groups)) { |
| 211 | - $where = $fileDependentWhere . ' WHERE `' . $column . '` = ? AND `item_type` = ? AND `share_with` in (?)'; |
|
| 211 | + $where = $fileDependentWhere.' WHERE `'.$column.'` = ? AND `item_type` = ? AND `share_with` in (?)'; |
|
| 212 | 212 | $arguments = array($itemSource, $itemType, $groups); |
| 213 | 213 | $types = array(null, null, IQueryBuilder::PARAM_STR_ARRAY); |
| 214 | 214 | |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | // class isn't static anymore... |
| 223 | 223 | $conn = \OC::$server->getDatabaseConnection(); |
| 224 | 224 | $result = $conn->executeQuery( |
| 225 | - 'SELECT ' . $select . ' FROM `*PREFIX*share` ' . $where, |
|
| 225 | + 'SELECT '.$select.' FROM `*PREFIX*share` '.$where, |
|
| 226 | 226 | $arguments, |
| 227 | 227 | $types |
| 228 | 228 | ); |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | $query = \OC_DB::prepare('SELECT * FROM `*PREFIX*share` WHERE `token` = ?', 1); |
| 265 | 265 | $result = $query->execute(array($token)); |
| 266 | 266 | if ($result === false) { |
| 267 | - \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage() . ', token=' . $token, ILogger::ERROR); |
|
| 267 | + \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage().', token='.$token, ILogger::ERROR); |
|
| 268 | 268 | } |
| 269 | 269 | $row = $result->fetchRow(); |
| 270 | 270 | if ($row === false) { |
@@ -371,12 +371,12 @@ discard block |
||
| 371 | 371 | |
| 372 | 372 | //verify that we don't share a folder which already contains a share mount point |
| 373 | 373 | if ($itemType === 'folder') { |
| 374 | - $path = '/' . $uidOwner . '/files' . \OC\Files\Filesystem::getPath($itemSource) . '/'; |
|
| 374 | + $path = '/'.$uidOwner.'/files'.\OC\Files\Filesystem::getPath($itemSource).'/'; |
|
| 375 | 375 | $mountManager = \OC\Files\Filesystem::getMountManager(); |
| 376 | 376 | $mounts = $mountManager->findIn($path); |
| 377 | 377 | foreach ($mounts as $mount) { |
| 378 | 378 | if ($mount->getStorage()->instanceOfStorage('\OCA\Files_Sharing\ISharedStorage')) { |
| 379 | - $message = 'Sharing "' . $itemSourceName . '" failed, because it contains files shared with you!'; |
|
| 379 | + $message = 'Sharing "'.$itemSourceName.'" failed, because it contains files shared with you!'; |
|
| 380 | 380 | \OCP\Util::writeLog('OCP\Share', $message, ILogger::DEBUG); |
| 381 | 381 | throw new \Exception($message); |
| 382 | 382 | } |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | |
| 387 | 387 | // single file shares should never have delete permissions |
| 388 | 388 | if ($itemType === 'file') { |
| 389 | - $permissions = (int)$permissions & ~\OCP\Constants::PERMISSION_DELETE; |
|
| 389 | + $permissions = (int) $permissions & ~\OCP\Constants::PERMISSION_DELETE; |
|
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | //Validate expirationDate |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | } else { |
| 541 | 541 | // reuse the already set password, but only if we change permissions |
| 542 | 542 | // otherwise the user disabled the password protection |
| 543 | - if ($checkExists && (int)$permissions !== (int)$oldPermissions) { |
|
| 543 | + if ($checkExists && (int) $permissions !== (int) $oldPermissions) { |
|
| 544 | 544 | $shareWith = $checkExists['share_with']; |
| 545 | 545 | } |
| 546 | 546 | } |
@@ -612,10 +612,10 @@ discard block |
||
| 612 | 612 | throw new \Exception($message_t); |
| 613 | 613 | } |
| 614 | 614 | |
| 615 | - $token = \OC::$server->getSecureRandom()->generate(self::TOKEN_LENGTH, \OCP\Security\ISecureRandom::CHAR_LOWER . \OCP\Security\ISecureRandom::CHAR_UPPER . |
|
| 615 | + $token = \OC::$server->getSecureRandom()->generate(self::TOKEN_LENGTH, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_UPPER. |
|
| 616 | 616 | \OCP\Security\ISecureRandom::CHAR_DIGITS); |
| 617 | 617 | |
| 618 | - $shareWith = $user . '@' . $remote; |
|
| 618 | + $shareWith = $user.'@'.$remote; |
|
| 619 | 619 | $shareId = self::put($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $permissions, null, $token, $itemSourceName); |
| 620 | 620 | |
| 621 | 621 | $send = false; |
@@ -666,12 +666,12 @@ discard block |
||
| 666 | 666 | $currentUser = $owner ? $owner : \OC_User::getUser(); |
| 667 | 667 | foreach ($items as $item) { |
| 668 | 668 | // delete the item with the expected share_type and owner |
| 669 | - if ((int)$item['share_type'] === (int)$shareType && $item['uid_owner'] === $currentUser) { |
|
| 669 | + if ((int) $item['share_type'] === (int) $shareType && $item['uid_owner'] === $currentUser) { |
|
| 670 | 670 | $toDelete = $item; |
| 671 | 671 | // if there is more then one result we don't have to delete the children |
| 672 | 672 | // but update their parent. For group shares the new parent should always be |
| 673 | 673 | // the original group share and not the db entry with the unique name |
| 674 | - } else if ((int)$item['share_type'] === self::$shareTypeGroupUserUnique) { |
|
| 674 | + } else if ((int) $item['share_type'] === self::$shareTypeGroupUserUnique) { |
|
| 675 | 675 | $newParent = $item['parent']; |
| 676 | 676 | } else { |
| 677 | 677 | $newParent = $item['id']; |
@@ -703,7 +703,7 @@ discard block |
||
| 703 | 703 | |
| 704 | 704 | $result = $query->execute(array($status, $itemType, $itemSource, $shareType, $recipient)); |
| 705 | 705 | |
| 706 | - if($result === false) { |
|
| 706 | + if ($result === false) { |
|
| 707 | 707 | \OCP\Util::writeLog('OCP\Share', 'Couldn\'t set send mail status', ILogger::ERROR); |
| 708 | 708 | } |
| 709 | 709 | } |
@@ -729,7 +729,7 @@ discard block |
||
| 729 | 729 | if ($defaultExpireDateEnforced && $shareTime === null) { |
| 730 | 730 | $items = self::getItemShared($itemType, $itemSource); |
| 731 | 731 | $firstItem = reset($items); |
| 732 | - $shareTime = (int)$firstItem['stime']; |
|
| 732 | + $shareTime = (int) $firstItem['stime']; |
|
| 733 | 733 | } |
| 734 | 734 | |
| 735 | 735 | if ($defaultExpireDateEnforced) { |
@@ -737,9 +737,9 @@ discard block |
||
| 737 | 737 | $maxDate = new \DateTime(); |
| 738 | 738 | $maxDate->setTimestamp($shareTime); |
| 739 | 739 | $maxDays = \OC::$server->getConfig()->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
| 740 | - $maxDate->add(new \DateInterval('P' . $maxDays . 'D')); |
|
| 740 | + $maxDate->add(new \DateInterval('P'.$maxDays.'D')); |
|
| 741 | 741 | if ($date > $maxDate) { |
| 742 | - $warning = 'Cannot set expiration date. Shares cannot expire later than ' . $maxDays . ' after they have been shared'; |
|
| 742 | + $warning = 'Cannot set expiration date. Shares cannot expire later than '.$maxDays.' after they have been shared'; |
|
| 743 | 743 | $warning_t = $l->t('Cannot set expiration date. Shares cannot expire later than %s after they have been shared', array($maxDays)); |
| 744 | 744 | \OCP\Util::writeLog('OCP\Share', $warning, ILogger::WARN); |
| 745 | 745 | throw new \Exception($warning_t); |
@@ -801,7 +801,7 @@ discard block |
||
| 801 | 801 | */ |
| 802 | 802 | protected static function unshareItem(array $item, $newParent = null) { |
| 803 | 803 | |
| 804 | - $shareType = (int)$item['share_type']; |
|
| 804 | + $shareType = (int) $item['share_type']; |
|
| 805 | 805 | $shareWith = null; |
| 806 | 806 | if ($shareType !== \OCP\Share::SHARE_TYPE_LINK) { |
| 807 | 807 | $shareWith = $item['share_with']; |
@@ -817,7 +817,7 @@ discard block |
||
| 817 | 817 | 'itemParent' => $item['parent'], |
| 818 | 818 | 'uidOwner' => $item['uid_owner'], |
| 819 | 819 | ); |
| 820 | - if($item['item_type'] === 'file' || $item['item_type'] === 'folder') { |
|
| 820 | + if ($item['item_type'] === 'file' || $item['item_type'] === 'folder') { |
|
| 821 | 821 | $hookParams['fileSource'] = $item['file_source']; |
| 822 | 822 | $hookParams['fileTarget'] = $item['file_target']; |
| 823 | 823 | } |
@@ -827,7 +827,7 @@ discard block |
||
| 827 | 827 | $deletedShares[] = $hookParams; |
| 828 | 828 | $hookParams['deletedShares'] = $deletedShares; |
| 829 | 829 | \OC_Hook::emit(\OCP\Share::class, 'post_unshare', $hookParams); |
| 830 | - if ((int)$item['share_type'] === \OCP\Share::SHARE_TYPE_REMOTE && \OC::$server->getUserSession()->getUser()) { |
|
| 830 | + if ((int) $item['share_type'] === \OCP\Share::SHARE_TYPE_REMOTE && \OC::$server->getUserSession()->getUser()) { |
|
| 831 | 831 | list(, $remote) = Helper::splitUserRemote($item['share_with']); |
| 832 | 832 | self::sendRemoteUnshare($remote, $item['id'], $item['token']); |
| 833 | 833 | } |
@@ -988,7 +988,7 @@ discard block |
||
| 988 | 988 | // Get filesystem root to add it to the file target and remove from the |
| 989 | 989 | // file source, match file_source with the file cache |
| 990 | 990 | if ($itemType == 'file' || $itemType == 'folder') { |
| 991 | - if(!is_null($uidOwner)) { |
|
| 991 | + if (!is_null($uidOwner)) { |
|
| 992 | 992 | $root = \OC\Files\Filesystem::getRoot(); |
| 993 | 993 | } else { |
| 994 | 994 | $root = ''; |
@@ -1133,7 +1133,7 @@ discard block |
||
| 1133 | 1133 | $result = $query->execute($queryArgs); |
| 1134 | 1134 | if ($result === false) { |
| 1135 | 1135 | \OCP\Util::writeLog('OCP\Share', |
| 1136 | - \OC_DB::getErrorMessage() . ', select=' . $select . ' where=', |
|
| 1136 | + \OC_DB::getErrorMessage().', select='.$select.' where=', |
|
| 1137 | 1137 | ILogger::ERROR); |
| 1138 | 1138 | } |
| 1139 | 1139 | $items = array(); |
@@ -1175,14 +1175,14 @@ discard block |
||
| 1175 | 1175 | } |
| 1176 | 1176 | // Switch ids if sharing permission is granted on only |
| 1177 | 1177 | // one share to ensure correct parent is used if resharing |
| 1178 | - if (~(int)$items[$id]['permissions'] & \OCP\Constants::PERMISSION_SHARE |
|
| 1179 | - && (int)$row['permissions'] & \OCP\Constants::PERMISSION_SHARE) { |
|
| 1178 | + if (~(int) $items[$id]['permissions'] & \OCP\Constants::PERMISSION_SHARE |
|
| 1179 | + && (int) $row['permissions'] & \OCP\Constants::PERMISSION_SHARE) { |
|
| 1180 | 1180 | $items[$row['id']] = $items[$id]; |
| 1181 | 1181 | $switchedItems[$id] = $row['id']; |
| 1182 | 1182 | unset($items[$id]); |
| 1183 | 1183 | $id = $row['id']; |
| 1184 | 1184 | } |
| 1185 | - $items[$id]['permissions'] |= (int)$row['permissions']; |
|
| 1185 | + $items[$id]['permissions'] |= (int) $row['permissions']; |
|
| 1186 | 1186 | |
| 1187 | 1187 | } |
| 1188 | 1188 | continue; |
@@ -1196,8 +1196,8 @@ discard block |
||
| 1196 | 1196 | $query = \OC_DB::prepare('SELECT `file_target` FROM `*PREFIX*share` WHERE `id` = ?'); |
| 1197 | 1197 | $parentResult = $query->execute(array($row['parent'])); |
| 1198 | 1198 | if ($result === false) { |
| 1199 | - \OCP\Util::writeLog('OCP\Share', 'Can\'t select parent: ' . |
|
| 1200 | - \OC_DB::getErrorMessage() . ', select=' . $select . ' where=' . $where, |
|
| 1199 | + \OCP\Util::writeLog('OCP\Share', 'Can\'t select parent: '. |
|
| 1200 | + \OC_DB::getErrorMessage().', select='.$select.' where='.$where, |
|
| 1201 | 1201 | ILogger::ERROR); |
| 1202 | 1202 | } else { |
| 1203 | 1203 | $parentRow = $parentResult->fetchRow(); |
@@ -1207,7 +1207,7 @@ discard block |
||
| 1207 | 1207 | $subPath = substr($row['path'], $pos); |
| 1208 | 1208 | $splitPath = explode('/', $subPath); |
| 1209 | 1209 | foreach (array_slice($splitPath, 2) as $pathPart) { |
| 1210 | - $tmpPath = $tmpPath . '/' . $pathPart; |
|
| 1210 | + $tmpPath = $tmpPath.'/'.$pathPart; |
|
| 1211 | 1211 | } |
| 1212 | 1212 | $row['path'] = $tmpPath; |
| 1213 | 1213 | } |
@@ -1226,7 +1226,7 @@ discard block |
||
| 1226 | 1226 | } |
| 1227 | 1227 | } |
| 1228 | 1228 | |
| 1229 | - if($checkExpireDate) { |
|
| 1229 | + if ($checkExpireDate) { |
|
| 1230 | 1230 | if (self::expireItem($row)) { |
| 1231 | 1231 | continue; |
| 1232 | 1232 | } |
@@ -1237,11 +1237,11 @@ discard block |
||
| 1237 | 1237 | } |
| 1238 | 1238 | // Add display names to result |
| 1239 | 1239 | $row['share_with_displayname'] = $row['share_with']; |
| 1240 | - if ( isset($row['share_with']) && $row['share_with'] != '' && |
|
| 1240 | + if (isset($row['share_with']) && $row['share_with'] != '' && |
|
| 1241 | 1241 | $row['share_type'] === self::SHARE_TYPE_USER) { |
| 1242 | 1242 | $shareWithUser = \OC::$server->getUserManager()->get($row['share_with']); |
| 1243 | 1243 | $row['share_with_displayname'] = $shareWithUser === null ? $row['share_with'] : $shareWithUser->getDisplayName(); |
| 1244 | - } else if(isset($row['share_with']) && $row['share_with'] != '' && |
|
| 1244 | + } else if (isset($row['share_with']) && $row['share_with'] != '' && |
|
| 1245 | 1245 | $row['share_type'] === self::SHARE_TYPE_REMOTE) { |
| 1246 | 1246 | $addressBookEntries = \OC::$server->getContactsManager()->search($row['share_with'], ['CLOUD']); |
| 1247 | 1247 | foreach ($addressBookEntries as $entry) { |
@@ -1252,7 +1252,7 @@ discard block |
||
| 1252 | 1252 | } |
| 1253 | 1253 | } |
| 1254 | 1254 | } |
| 1255 | - if ( isset($row['uid_owner']) && $row['uid_owner'] != '') { |
|
| 1255 | + if (isset($row['uid_owner']) && $row['uid_owner'] != '') { |
|
| 1256 | 1256 | $ownerUser = \OC::$server->getUserManager()->get($row['uid_owner']); |
| 1257 | 1257 | $row['displayname_owner'] = $ownerUser === null ? $row['uid_owner'] : $ownerUser->getDisplayName(); |
| 1258 | 1258 | } |
@@ -1401,7 +1401,7 @@ discard block |
||
| 1401 | 1401 | // for file/folder shares we need to compare file_source, otherwise we compare item_source |
| 1402 | 1402 | // only group shares if they already point to the same target, otherwise the file where shared |
| 1403 | 1403 | // before grouping of shares was added. In this case we don't group them toi avoid confusions |
| 1404 | - if (( $fileSharing && $item['file_source'] === $r['file_source'] && $item['file_target'] === $r['file_target']) || |
|
| 1404 | + if (($fileSharing && $item['file_source'] === $r['file_source'] && $item['file_target'] === $r['file_target']) || |
|
| 1405 | 1405 | (!$fileSharing && $item['item_source'] === $r['item_source'] && $item['item_target'] === $r['item_target'])) { |
| 1406 | 1406 | // add the first item to the list of grouped shares |
| 1407 | 1407 | if (!isset($result[$key]['grouped'])) { |
@@ -1447,7 +1447,7 @@ discard block |
||
| 1447 | 1447 | $groupItemTarget = $itemTarget = $fileSource = $parent = 0; |
| 1448 | 1448 | |
| 1449 | 1449 | $result = self::checkReshare($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $permissions, $itemSourceName, $expirationDate); |
| 1450 | - if(!empty($result)) { |
|
| 1450 | + if (!empty($result)) { |
|
| 1451 | 1451 | $parent = $result['parent']; |
| 1452 | 1452 | $itemSource = $result['itemSource']; |
| 1453 | 1453 | $fileSource = $result['fileSource']; |
@@ -1541,11 +1541,11 @@ discard block |
||
| 1541 | 1541 | $itemTarget = $sourceExists['item_target']; |
| 1542 | 1542 | |
| 1543 | 1543 | // for group shares we don't need a additional entry if the target is the same |
| 1544 | - if($isGroupShare && $groupItemTarget === $itemTarget) { |
|
| 1544 | + if ($isGroupShare && $groupItemTarget === $itemTarget) { |
|
| 1545 | 1545 | continue; |
| 1546 | 1546 | } |
| 1547 | 1547 | |
| 1548 | - } elseif(!$sourceExists && !$isGroupShare) { |
|
| 1548 | + } elseif (!$sourceExists && !$isGroupShare) { |
|
| 1549 | 1549 | |
| 1550 | 1550 | $itemTarget = Helper::generateTarget($itemType, $itemSource, $userShareType, $user, |
| 1551 | 1551 | $uidOwner, $suggestedItemTarget, $parent); |
@@ -1676,8 +1676,8 @@ discard block |
||
| 1676 | 1676 | |
| 1677 | 1677 | if ($checkReshare && $checkReshare['uid_owner'] !== \OC_User::getUser()) { |
| 1678 | 1678 | // Check if share permissions is granted |
| 1679 | - if (self::isResharingAllowed() && (int)$checkReshare['permissions'] & \OCP\Constants::PERMISSION_SHARE) { |
|
| 1680 | - if (~(int)$checkReshare['permissions'] & $permissions) { |
|
| 1679 | + if (self::isResharingAllowed() && (int) $checkReshare['permissions'] & \OCP\Constants::PERMISSION_SHARE) { |
|
| 1680 | + if (~(int) $checkReshare['permissions'] & $permissions) { |
|
| 1681 | 1681 | $message = 'Sharing %1$s failed, because the permissions exceed permissions granted to %2$s'; |
| 1682 | 1682 | $message_t = $l->t('Sharing %1$s failed, because the permissions exceed permissions granted to %2$s', array($itemSourceName, $uidOwner)); |
| 1683 | 1683 | |
@@ -1689,7 +1689,7 @@ discard block |
||
| 1689 | 1689 | |
| 1690 | 1690 | $result['expirationDate'] = $expirationDate; |
| 1691 | 1691 | // $checkReshare['expiration'] could be null and then is always less than any value |
| 1692 | - if(isset($checkReshare['expiration']) && $checkReshare['expiration'] < $expirationDate) { |
|
| 1692 | + if (isset($checkReshare['expiration']) && $checkReshare['expiration'] < $expirationDate) { |
|
| 1693 | 1693 | $result['expirationDate'] = $checkReshare['expiration']; |
| 1694 | 1694 | } |
| 1695 | 1695 | |
@@ -1781,7 +1781,7 @@ discard block |
||
| 1781 | 1781 | |
| 1782 | 1782 | $id = false; |
| 1783 | 1783 | if ($result) { |
| 1784 | - $id = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*share'); |
|
| 1784 | + $id = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*share'); |
|
| 1785 | 1785 | } |
| 1786 | 1786 | |
| 1787 | 1787 | return $id; |
@@ -1809,8 +1809,8 @@ discard block |
||
| 1809 | 1809 | return true; |
| 1810 | 1810 | } |
| 1811 | 1811 | |
| 1812 | - if ( \OC::$server->getSession()->exists('public_link_authenticated') |
|
| 1813 | - && \OC::$server->getSession()->get('public_link_authenticated') === (string)$linkItem['id'] ) { |
|
| 1812 | + if (\OC::$server->getSession()->exists('public_link_authenticated') |
|
| 1813 | + && \OC::$server->getSession()->get('public_link_authenticated') === (string) $linkItem['id']) { |
|
| 1814 | 1814 | return true; |
| 1815 | 1815 | } |
| 1816 | 1816 | |
@@ -1912,7 +1912,7 @@ discard block |
||
| 1912 | 1912 | * @param array $parameters additional format parameters |
| 1913 | 1913 | * @return array format result |
| 1914 | 1914 | */ |
| 1915 | - private static function formatResult($items, $column, $backend, $format = self::FORMAT_NONE , $parameters = null) { |
|
| 1915 | + private static function formatResult($items, $column, $backend, $format = self::FORMAT_NONE, $parameters = null) { |
|
| 1916 | 1916 | if ($format === self::FORMAT_NONE) { |
| 1917 | 1917 | return $items; |
| 1918 | 1918 | } else if ($format === self::FORMAT_STATUSES) { |
@@ -1969,13 +1969,13 @@ discard block |
||
| 1969 | 1969 | $try = 0; |
| 1970 | 1970 | $discoveryService = \OC::$server->query(\OCP\OCS\IDiscoveryService::class); |
| 1971 | 1971 | while ($result['success'] === false && $try < 2) { |
| 1972 | - $federationEndpoints = $discoveryService->discover($protocol . $remoteDomain, 'FEDERATED_SHARING'); |
|
| 1972 | + $federationEndpoints = $discoveryService->discover($protocol.$remoteDomain, 'FEDERATED_SHARING'); |
|
| 1973 | 1973 | $endpoint = isset($federationEndpoints['share']) ? $federationEndpoints['share'] : '/ocs/v2.php/cloud/shares'; |
| 1974 | 1974 | $client = \OC::$server->getHTTPClientService()->newClient(); |
| 1975 | 1975 | |
| 1976 | 1976 | try { |
| 1977 | 1977 | $response = $client->post( |
| 1978 | - $protocol . $remoteDomain . $endpoint . $urlSuffix . '?format=' . self::RESPONSE_FORMAT, |
|
| 1978 | + $protocol.$remoteDomain.$endpoint.$urlSuffix.'?format='.self::RESPONSE_FORMAT, |
|
| 1979 | 1979 | [ |
| 1980 | 1980 | 'body' => $fields, |
| 1981 | 1981 | 'connect_timeout' => 10, |
@@ -2075,7 +2075,7 @@ discard block |
||
| 2075 | 2075 | * @return int |
| 2076 | 2076 | */ |
| 2077 | 2077 | public static function getExpireInterval() { |
| 2078 | - return (int)\OC::$server->getConfig()->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
| 2078 | + return (int) \OC::$server->getConfig()->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
| 2079 | 2079 | } |
| 2080 | 2080 | |
| 2081 | 2081 | /** |