@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | $input = $host; |
65 | 65 | if (strpos($host, '://') === false) { |
66 | 66 | // add a protocol to fix parse_url behavior with ipv6 |
67 | - $host = 'http://' . $host; |
|
67 | + $host = 'http://'.$host; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | $parsed = parse_url($host); |
71 | - if(is_array($parsed) && isset($parsed['port'])) { |
|
71 | + if (is_array($parsed) && isset($parsed['port'])) { |
|
72 | 72 | return [$parsed['host'], $parsed['port']]; |
73 | 73 | } else if (is_array($parsed)) { |
74 | 74 | return [$parsed['host'], 22]; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | // Register sftp:// |
85 | 85 | Stream::register(); |
86 | 86 | |
87 | - $parsedHost = $this->splitHost($params['host']); |
|
87 | + $parsedHost = $this->splitHost($params['host']); |
|
88 | 88 | |
89 | 89 | $this->host = $parsedHost[0]; |
90 | 90 | $this->port = $parsedHost[1]; |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | $this->root |
109 | 109 | = isset($params['root']) ? $this->cleanPath($params['root']) : '/'; |
110 | 110 | |
111 | - $this->root = '/' . ltrim($this->root, '/'); |
|
112 | - $this->root = rtrim($this->root, '/') . '/'; |
|
111 | + $this->root = '/'.ltrim($this->root, '/'); |
|
112 | + $this->root = rtrim($this->root, '/').'/'; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -167,15 +167,15 @@ discard block |
||
167 | 167 | /** |
168 | 168 | * {@inheritdoc} |
169 | 169 | */ |
170 | - public function getId(){ |
|
171 | - $id = 'sftp::' . $this->user . '@' . $this->host; |
|
170 | + public function getId() { |
|
171 | + $id = 'sftp::'.$this->user.'@'.$this->host; |
|
172 | 172 | if ($this->port !== 22) { |
173 | - $id .= ':' . $this->port; |
|
173 | + $id .= ':'.$this->port; |
|
174 | 174 | } |
175 | 175 | // note: this will double the root slash, |
176 | 176 | // we should not change it to keep compatible with |
177 | 177 | // old storage ids |
178 | - $id .= '/' . $this->root; |
|
178 | + $id .= '/'.$this->root; |
|
179 | 179 | return $id; |
180 | 180 | } |
181 | 181 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | * @return string |
206 | 206 | */ |
207 | 207 | private function absPath($path) { |
208 | - return $this->root . $this->cleanPath($path); |
|
208 | + return $this->root.$this->cleanPath($path); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
@@ -215,8 +215,8 @@ discard block |
||
215 | 215 | try { |
216 | 216 | $storage_view = \OCP\Files::getStorage('files_external'); |
217 | 217 | if ($storage_view) { |
218 | - return \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . |
|
219 | - $storage_view->getAbsolutePath('') . |
|
218 | + return \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data'). |
|
219 | + $storage_view->getAbsolutePath(''). |
|
220 | 220 | 'ssh_hostKeys'; |
221 | 221 | } |
222 | 222 | } catch (\Exception $e) { |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | if ($keyPath && file_exists($keyPath)) { |
235 | 235 | $fp = fopen($keyPath, 'w'); |
236 | 236 | foreach ($keys as $host => $key) { |
237 | - fwrite($fp, $host . '::' . $key . "\n"); |
|
237 | + fwrite($fp, $host.'::'.$key."\n"); |
|
238 | 238 | } |
239 | 239 | fclose($fp); |
240 | 240 | return true; |
@@ -306,15 +306,15 @@ discard block |
||
306 | 306 | return false; |
307 | 307 | } |
308 | 308 | |
309 | - $id = md5('sftp:' . $path); |
|
309 | + $id = md5('sftp:'.$path); |
|
310 | 310 | $dirStream = []; |
311 | - foreach($list as $file) { |
|
311 | + foreach ($list as $file) { |
|
312 | 312 | if ($file !== '.' && $file !== '..') { |
313 | 313 | $dirStream[] = $file; |
314 | 314 | } |
315 | 315 | } |
316 | 316 | return IteratorDirectory::wrap($dirStream); |
317 | - } catch(\Exception $e) { |
|
317 | + } catch (\Exception $e) { |
|
318 | 318 | return false; |
319 | 319 | } |
320 | 320 | } |
@@ -366,21 +366,21 @@ discard block |
||
366 | 366 | public function fopen($path, $mode) { |
367 | 367 | try { |
368 | 368 | $absPath = $this->absPath($path); |
369 | - switch($mode) { |
|
369 | + switch ($mode) { |
|
370 | 370 | case 'r': |
371 | 371 | case 'rb': |
372 | - if ( !$this->file_exists($path)) { |
|
372 | + if (!$this->file_exists($path)) { |
|
373 | 373 | return false; |
374 | 374 | } |
375 | 375 | SFTPReadStream::register(); |
376 | 376 | $context = stream_context_create(['sftp' => ['session' => $this->getConnection()]]); |
377 | - $handle = fopen('sftpread://' . trim($absPath, '/'), 'r', false, $context); |
|
377 | + $handle = fopen('sftpread://'.trim($absPath, '/'), 'r', false, $context); |
|
378 | 378 | return RetryWrapper::wrap($handle); |
379 | 379 | case 'w': |
380 | 380 | case 'wb': |
381 | 381 | SFTPWriteStream::register(); |
382 | 382 | $context = stream_context_create(['sftp' => ['session' => $this->getConnection()]]); |
383 | - return fopen('sftpwrite://' . trim($absPath, '/'), 'w', false, $context); |
|
383 | + return fopen('sftpwrite://'.trim($absPath, '/'), 'w', false, $context); |
|
384 | 384 | case 'a': |
385 | 385 | case 'ab': |
386 | 386 | case 'r+': |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | /** |
404 | 404 | * {@inheritdoc} |
405 | 405 | */ |
406 | - public function touch($path, $mtime=null) { |
|
406 | + public function touch($path, $mtime = null) { |
|
407 | 407 | try { |
408 | 408 | if (!is_null($mtime)) { |
409 | 409 | return false; |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | // Do not pass the password here. We want to use the Net_SFTP object |
479 | 479 | // supplied via stream context or fail. We only supply username and |
480 | 480 | // hostname because this might show up in logs (they are not used). |
481 | - $url = 'sftp://' . urlencode($this->user) . '@' . $this->host . ':' . $this->port . $this->root . $path; |
|
481 | + $url = 'sftp://'.urlencode($this->user).'@'.$this->host.':'.$this->port.$this->root.$path; |
|
482 | 482 | return $url; |
483 | 483 | } |
484 | 484 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | const APP_ID = 'comments'; |
46 | 46 | |
47 | - public function __construct (array $urlParams = []) { |
|
47 | + public function __construct(array $urlParams = []) { |
|
48 | 48 | parent::__construct(self::APP_ID, $urlParams); |
49 | 49 | $container = $this->getContainer(); |
50 | 50 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | protected function registerDavEntity(IEventDispatcher $dispatcher) { |
79 | 79 | $dispatcher->addListener(CommentsEntityEvent::EVENT_ENTITY, function(CommentsEntityEvent $event) { |
80 | 80 | $event->addEntityCollection('files', function($name) { |
81 | - $nodes = \OC::$server->getUserFolder()->getById((int)$name); |
|
81 | + $nodes = \OC::$server->getUserFolder()->getById((int) $name); |
|
82 | 82 | return !empty($nodes); |
83 | 83 | }); |
84 | 84 | }); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | protected function registerCommentsEventHandler() { |
92 | - $this->getContainer()->getServer()->getCommentsManager()->registerEventHandler(function () { |
|
92 | + $this->getContainer()->getServer()->getCommentsManager()->registerEventHandler(function() { |
|
93 | 93 | return $this->getContainer()->query(EventHandler::class); |
94 | 94 | }); |
95 | 95 | } |
@@ -238,11 +238,11 @@ discard block |
||
238 | 238 | } |
239 | 239 | |
240 | 240 | $data = [ |
241 | - 'attendee_name' => (string)$meetingAttendeeName ?: $defaultVal, |
|
242 | - 'invitee_name' => (string)$meetingInviteeName ?: $defaultVal, |
|
243 | - 'meeting_title' => (string)$meetingTitle ?: $defaultVal, |
|
244 | - 'meeting_description' => (string)$meetingDescription ?: $defaultVal, |
|
245 | - 'meeting_url' => (string)$meetingUrl ?: $defaultVal, |
|
241 | + 'attendee_name' => (string) $meetingAttendeeName ?: $defaultVal, |
|
242 | + 'invitee_name' => (string) $meetingInviteeName ?: $defaultVal, |
|
243 | + 'meeting_title' => (string) $meetingTitle ?: $defaultVal, |
|
244 | + 'meeting_description' => (string) $meetingDescription ?: $defaultVal, |
|
245 | + 'meeting_url' => (string) $meetingUrl ?: $defaultVal, |
|
246 | 246 | ]; |
247 | 247 | |
248 | 248 | $fromEMail = \OCP\Util::getDefaultEmailAddress('invitations-noreply'); |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | ->setReplyTo([$sender => $senderName]) |
254 | 254 | ->setTo([$recipient => $recipientName]); |
255 | 255 | |
256 | - $template = $this->mailer->createEMailTemplate('dav.calendarInvite.' . $method, $data); |
|
256 | + $template = $this->mailer->createEMailTemplate('dav.calendarInvite.'.$method, $data); |
|
257 | 257 | $template->addHeader(); |
258 | 258 | |
259 | 259 | $this->addSubjectAndHeading($template, $l10n, $method, $summary, |
@@ -300,8 +300,8 @@ discard block |
||
300 | 300 | |
301 | 301 | $attachment = $this->mailer->createAttachment( |
302 | 302 | $iTipMessage->message->serialize(), |
303 | - 'event.ics',// TODO(leon): Make file name unique, e.g. add event id |
|
304 | - 'text/calendar; method=' . $iTipMessage->method |
|
303 | + 'event.ics', // TODO(leon): Make file name unique, e.g. add event id |
|
304 | + 'text/calendar; method='.$iTipMessage->method |
|
305 | 305 | ); |
306 | 306 | $message->attach($attachment); |
307 | 307 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | $this->logger->error('Unable to deliver message to {failed}', ['app' => 'dav', 'failed' => implode(', ', $failed)]); |
313 | 313 | $iTipMessage->scheduleStatus = '5.0; EMail delivery failed'; |
314 | 314 | } |
315 | - } catch(\Exception $ex) { |
|
315 | + } catch (\Exception $ex) { |
|
316 | 316 | $this->logger->logException($ex, ['app' => 'dav']); |
317 | 317 | $iTipMessage->scheduleStatus = '5.0; EMail delivery failed'; |
318 | 318 | } |
@@ -348,13 +348,13 @@ discard block |
||
348 | 348 | $lastOccurrence = $firstOccurrence; |
349 | 349 | } |
350 | 350 | } else { |
351 | - $it = new EventIterator($vObject, (string)$component->UID); |
|
351 | + $it = new EventIterator($vObject, (string) $component->UID); |
|
352 | 352 | $maxDate = new \DateTime(self::MAX_DATE); |
353 | 353 | if ($it->isInfinite()) { |
354 | 354 | $lastOccurrence = $maxDate->getTimestamp(); |
355 | 355 | } else { |
356 | 356 | $end = $it->getDtEnd(); |
357 | - while($it->valid() && $end < $maxDate) { |
|
357 | + while ($it->valid() && $end < $maxDate) { |
|
358 | 358 | $end = $it->getDtEnd(); |
359 | 359 | $it->next(); |
360 | 360 | |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | $localeStart = $l10n->l('date', $dtstartDt, ['width' => 'medium']); |
449 | 449 | $localeEnd = $l10n->l('date', $dtendDt, ['width' => 'medium']); |
450 | 450 | |
451 | - return $localeStart . ' - ' . $localeEnd; |
|
451 | + return $localeStart.' - '.$localeEnd; |
|
452 | 452 | } |
453 | 453 | |
454 | 454 | /** @var Property\ICalendar\DateTime $dtstart */ |
@@ -467,26 +467,26 @@ discard block |
||
467 | 467 | } |
468 | 468 | } |
469 | 469 | |
470 | - $localeStart = $l10n->l('weekdayName', $dtstartDt, ['width' => 'abbreviated']) . ', ' . |
|
470 | + $localeStart = $l10n->l('weekdayName', $dtstartDt, ['width' => 'abbreviated']).', '. |
|
471 | 471 | $l10n->l('datetime', $dtstartDt, ['width' => 'medium|short']); |
472 | 472 | |
473 | 473 | // always show full date with timezone if timezones are different |
474 | 474 | if ($startTimezone !== $endTimezone) { |
475 | 475 | $localeEnd = $l10n->l('datetime', $dtendDt, ['width' => 'medium|short']); |
476 | 476 | |
477 | - return $localeStart . ' (' . $startTimezone . ') - ' . |
|
478 | - $localeEnd . ' (' . $endTimezone . ')'; |
|
477 | + return $localeStart.' ('.$startTimezone.') - '. |
|
478 | + $localeEnd.' ('.$endTimezone.')'; |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | // show only end time if date is the same |
482 | 482 | if ($this->isDayEqual($dtstartDt, $dtendDt)) { |
483 | 483 | $localeEnd = $l10n->l('time', $dtendDt, ['width' => 'short']); |
484 | 484 | } else { |
485 | - $localeEnd = $l10n->l('weekdayName', $dtendDt, ['width' => 'abbreviated']) . ', ' . |
|
485 | + $localeEnd = $l10n->l('weekdayName', $dtendDt, ['width' => 'abbreviated']).', '. |
|
486 | 486 | $l10n->l('datetime', $dtendDt, ['width' => 'medium|short']); |
487 | 487 | } |
488 | 488 | |
489 | - return $localeStart . ' - ' . $localeEnd . ' (' . $startTimezone . ')'; |
|
489 | + return $localeStart.' - '.$localeEnd.' ('.$startTimezone.')'; |
|
490 | 490 | } |
491 | 491 | |
492 | 492 | /** |
@@ -509,15 +509,15 @@ discard block |
||
509 | 509 | private function addSubjectAndHeading(IEMailTemplate $template, IL10N $l10n, |
510 | 510 | $method, $summary, $attendeeName, $inviteeName) { |
511 | 511 | if ($method === self::METHOD_CANCEL) { |
512 | - $template->setSubject('Cancelled: ' . $summary); |
|
512 | + $template->setSubject('Cancelled: '.$summary); |
|
513 | 513 | $template->addHeading($l10n->t('Invitation canceled'), $l10n->t('Hello %s,', [$attendeeName])); |
514 | 514 | $template->addBodyText($l10n->t('The meeting »%1$s« with %2$s was canceled.', [$summary, $inviteeName])); |
515 | 515 | } else if ($method === self::METHOD_REPLY) { |
516 | - $template->setSubject('Re: ' . $summary); |
|
516 | + $template->setSubject('Re: '.$summary); |
|
517 | 517 | $template->addHeading($l10n->t('Invitation updated'), $l10n->t('Hello %s,', [$attendeeName])); |
518 | 518 | $template->addBodyText($l10n->t('The meeting »%1$s« with %2$s was updated.', [$summary, $inviteeName])); |
519 | 519 | } else { |
520 | - $template->setSubject('Invitation: ' . $summary); |
|
520 | + $template->setSubject('Invitation: '.$summary); |
|
521 | 521 | $template->addHeading($l10n->t('%1$s invited you to »%2$s«', [$inviteeName, $summary]), $l10n->t('Hello %s,', [$attendeeName])); |
522 | 522 | } |
523 | 523 | } |
@@ -539,11 +539,11 @@ discard block |
||
539 | 539 | $this->getAbsoluteImagePath('filetypes/location.svg')); |
540 | 540 | } |
541 | 541 | if ($description) { |
542 | - $template->addBodyListItem((string)$description, $l10n->t('Description:'), |
|
542 | + $template->addBodyListItem((string) $description, $l10n->t('Description:'), |
|
543 | 543 | $this->getAbsoluteImagePath('filetypes/text.svg')); |
544 | 544 | } |
545 | 545 | if ($url) { |
546 | - $template->addBodyListItem((string)$url, $l10n->t('Link:'), |
|
546 | + $template->addBodyListItem((string) $url, $l10n->t('Link:'), |
|
547 | 547 | $this->getAbsoluteImagePath('filetypes/link.svg')); |
548 | 548 | } |
549 | 549 | } |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | * @return string |
597 | 597 | */ |
598 | 598 | private function createInvitationToken(Message $iTipMessage, $lastOccurrence):string { |
599 | - $token = $this->random->generate(60, ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_DIGITS); |
|
599 | + $token = $this->random->generate(60, ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_DIGITS); |
|
600 | 600 | |
601 | 601 | /** @var VEvent $vevent */ |
602 | 602 | $vevent = $iTipMessage->message->VEVENT; |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $this->server->on('propPatch', [$this, 'handleUpdateProperties']); |
178 | 178 | $this->server->on('afterBind', [$this, 'sendFileIdHeader']); |
179 | 179 | $this->server->on('afterWriteContent', [$this, 'sendFileIdHeader']); |
180 | - $this->server->on('afterMethod:GET', [$this,'httpGet']); |
|
180 | + $this->server->on('afterMethod:GET', [$this, 'httpGet']); |
|
181 | 181 | $this->server->on('afterMethod:GET', [$this, 'handleDownloadToken']); |
182 | 182 | $this->server->on('afterResponse', function($request, ResponseInterface $response) { |
183 | 183 | $body = $response->getBody(); |
@@ -207,11 +207,11 @@ discard block |
||
207 | 207 | if ($sourceDir !== $destinationDir) { |
208 | 208 | $sourceNodeFileInfo = $sourceNode->getFileInfo(); |
209 | 209 | if ($sourceNodeFileInfo === null) { |
210 | - throw new NotFound($source . ' does not exist'); |
|
210 | + throw new NotFound($source.' does not exist'); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | if (!$sourceNodeFileInfo->isDeletable()) { |
214 | - throw new Forbidden($source . " cannot be deleted"); |
|
214 | + throw new Forbidden($source." cannot be deleted"); |
|
215 | 215 | } |
216 | 216 | } |
217 | 217 | } |
@@ -264,10 +264,10 @@ discard block |
||
264 | 264 | Request::USER_AGENT_ANDROID_MOBILE_CHROME, |
265 | 265 | Request::USER_AGENT_FREEBOX, |
266 | 266 | ])) { |
267 | - $response->addHeader('Content-Disposition', 'attachment; filename="' . rawurlencode($filename) . '"'); |
|
267 | + $response->addHeader('Content-Disposition', 'attachment; filename="'.rawurlencode($filename).'"'); |
|
268 | 268 | } else { |
269 | - $response->addHeader('Content-Disposition', 'attachment; filename*=UTF-8\'\'' . rawurlencode($filename) |
|
270 | - . '; filename="' . rawurlencode($filename) . '"'); |
|
269 | + $response->addHeader('Content-Disposition', 'attachment; filename*=UTF-8\'\''.rawurlencode($filename) |
|
270 | + . '; filename="'.rawurlencode($filename).'"'); |
|
271 | 271 | } |
272 | 272 | } |
273 | 273 | |
@@ -356,13 +356,13 @@ discard block |
||
356 | 356 | } |
357 | 357 | }); |
358 | 358 | |
359 | - $propFind->handle(self::HAS_PREVIEW_PROPERTYNAME, function () use ($node) { |
|
359 | + $propFind->handle(self::HAS_PREVIEW_PROPERTYNAME, function() use ($node) { |
|
360 | 360 | return json_encode($this->previewManager->isAvailable($node->getFileInfo())); |
361 | 361 | }); |
362 | 362 | $propFind->handle(self::SIZE_PROPERTYNAME, function() use ($node) { |
363 | 363 | return $node->getSize(); |
364 | 364 | }); |
365 | - $propFind->handle(self::MOUNT_TYPE_PROPERTYNAME, function () use ($node) { |
|
365 | + $propFind->handle(self::MOUNT_TYPE_PROPERTYNAME, function() use ($node) { |
|
366 | 366 | return $node->getFileInfo()->getMountPoint()->getMountType(); |
367 | 367 | }); |
368 | 368 | |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | list($path, $name) = \Sabre\Uri\split($filePath); |
503 | 503 | $info = \OC_FileChunking::decodeName($name); |
504 | 504 | if (!empty($info)) { |
505 | - $filePath = $path . '/' . $info['name']; |
|
505 | + $filePath = $path.'/'.$info['name']; |
|
506 | 506 | } |
507 | 507 | } |
508 | 508 |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function invertTextColor($color) { |
68 | 68 | $l = $this->calculateLuma($color); |
69 | - if($l>0.6) { |
|
69 | + if ($l > 0.6) { |
|
70 | 70 | return true; |
71 | 71 | } else { |
72 | 72 | return false; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function elementColor($color) { |
83 | 83 | $l = $this->calculateLuminance($color); |
84 | - if($l>0.8) { |
|
84 | + if ($l > 0.8) { |
|
85 | 85 | return '#aaaaaa'; |
86 | 86 | } |
87 | 87 | return $color; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | list($red, $green, $blue) = $this->hexToRGB($color); |
96 | 96 | $compiler = new Compiler(); |
97 | 97 | $hsl = $compiler->toHSL($red, $green, $blue); |
98 | - return $hsl[3]/100; |
|
98 | + return $hsl[3] / 100; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function calculateLuma($color) { |
106 | 106 | list($red, $green, $blue) = $this->hexToRGB($color); |
107 | - return (0.2126 * $red + 0.7152 * $green + 0.0722 * $blue) / 255; |
|
107 | + return (0.2126 * $red + 0.7152 * $green + 0.0722 * $blue) / 255; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | public function hexToRGB($color) { |
115 | 115 | $hex = preg_replace("/[^0-9A-Fa-f]/", '', $color); |
116 | 116 | if (strlen($hex) === 3) { |
117 | - $hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2]; |
|
117 | + $hex = $hex[0].$hex[0].$hex[1].$hex[1].$hex[2].$hex[2]; |
|
118 | 118 | } |
119 | 119 | if (strlen($hex) !== 6) { |
120 | 120 | return 0; |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * @return string base64 encoded radio button svg |
132 | 132 | */ |
133 | 133 | public function generateRadioButton($color) { |
134 | - $radioButtonIcon = '<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16">' . |
|
134 | + $radioButtonIcon = '<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16">'. |
|
135 | 135 | '<path d="M8 1a7 7 0 0 0-7 7 7 7 0 0 0 7 7 7 7 0 0 0 7-7 7 7 0 0 0-7-7zm0 1a6 6 0 0 1 6 6 6 6 0 0 1-6 6 6 6 0 0 1-6-6 6 6 0 0 1 6-6zm0 2a4 4 0 1 0 0 8 4 4 0 0 0 0-8z" fill="'.$color.'"/></svg>'; |
136 | 136 | return base64_encode($radioButtonIcon); |
137 | 137 | } |
@@ -145,11 +145,11 @@ discard block |
||
145 | 145 | $app = str_replace(['\0', '/', '\\', '..'], '', $app); |
146 | 146 | try { |
147 | 147 | $appPath = $this->appManager->getAppPath($app); |
148 | - $icon = $appPath . '/img/' . $app . '.svg'; |
|
148 | + $icon = $appPath.'/img/'.$app.'.svg'; |
|
149 | 149 | if (file_exists($icon)) { |
150 | 150 | return $icon; |
151 | 151 | } |
152 | - $icon = $appPath . '/img/app.svg'; |
|
152 | + $icon = $appPath.'/img/app.svg'; |
|
153 | 153 | if (file_exists($icon)) { |
154 | 154 | return $icon; |
155 | 155 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | } |
165 | 165 | } catch (NotFoundException $e) {} |
166 | 166 | } |
167 | - return \OC::$SERVERROOT . '/core/img/logo/logo.svg'; |
|
167 | + return \OC::$SERVERROOT.'/core/img/logo/logo.svg'; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $app = str_replace(['\0', '/', '\\', '..'], '', $app); |
177 | 177 | $image = str_replace(['\0', '\\', '..'], '', $image); |
178 | 178 | if ($app === "core") { |
179 | - $icon = \OC::$SERVERROOT . '/core/img/' . $image; |
|
179 | + $icon = \OC::$SERVERROOT.'/core/img/'.$image; |
|
180 | 180 | if (file_exists($icon)) { |
181 | 181 | return $icon; |
182 | 182 | } |
@@ -188,23 +188,23 @@ discard block |
||
188 | 188 | return false; |
189 | 189 | } |
190 | 190 | |
191 | - $icon = $appPath . '/img/' . $image; |
|
191 | + $icon = $appPath.'/img/'.$image; |
|
192 | 192 | if (file_exists($icon)) { |
193 | 193 | return $icon; |
194 | 194 | } |
195 | - $icon = $appPath . '/img/' . $image . '.svg'; |
|
195 | + $icon = $appPath.'/img/'.$image.'.svg'; |
|
196 | 196 | if (file_exists($icon)) { |
197 | 197 | return $icon; |
198 | 198 | } |
199 | - $icon = $appPath . '/img/' . $image . '.png'; |
|
199 | + $icon = $appPath.'/img/'.$image.'.png'; |
|
200 | 200 | if (file_exists($icon)) { |
201 | 201 | return $icon; |
202 | 202 | } |
203 | - $icon = $appPath . '/img/' . $image . '.gif'; |
|
203 | + $icon = $appPath.'/img/'.$image.'.gif'; |
|
204 | 204 | if (file_exists($icon)) { |
205 | 205 | return $icon; |
206 | 206 | } |
207 | - $icon = $appPath . '/img/' . $image . '.jpg'; |
|
207 | + $icon = $appPath.'/img/'.$image.'.jpg'; |
|
208 | 208 | if (file_exists($icon)) { |
209 | 209 | return $icon; |
210 | 210 | } |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | } |
239 | 239 | |
240 | 240 | public function isBackgroundThemed() { |
241 | - $backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime',false); |
|
241 | + $backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime', false); |
|
242 | 242 | |
243 | 243 | $backgroundExists = true; |
244 | 244 | try { |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | /** @var array $_ */ |
4 | 4 | |
5 | 5 | print_unescaped($l->t("Hey there,\n\nthe admin enabled server-side-encryption. Your files were encrypted using the password '%s'.\n\nPlease login to the web interface, go to the section 'basic encryption module' of your personal settings and update your encryption password by entering this password into the 'old log-in password' field and your current login-password.\n\n", [$_['password']])); |
6 | -if ( isset($_['expiration']) ) { |
|
6 | +if (isset($_['expiration'])) { |
|
7 | 7 | print_unescaped($l->t("The share will expire on %s.", [$_['expiration']])); |
8 | 8 | print_unescaped("\n\n"); |
9 | 9 | } |
@@ -12,5 +12,5 @@ discard block |
||
12 | 12 | ?> |
13 | 13 | |
14 | 14 | -- |
15 | -<?php p($theme->getName() . ' - ' . $theme->getSlogan()); ?> |
|
15 | +<?php p($theme->getName().' - '.$theme->getSlogan()); ?> |
|
16 | 16 | <?php print_unescaped("\n".$theme->getBaseUrl()); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $this->input = $input; |
135 | 135 | $this->output = $output; |
136 | 136 | |
137 | - $headline = 'Encrypt all files with the ' . Encryption::DISPLAY_NAME; |
|
137 | + $headline = 'Encrypt all files with the '.Encryption::DISPLAY_NAME; |
|
138 | 138 | $this->output->writeln("\n"); |
139 | 139 | $this->output->writeln($headline); |
140 | 140 | $this->output->writeln(str_pad('', strlen($headline), '=')); |
@@ -183,14 +183,14 @@ discard block |
||
183 | 183 | $progress->setFormat(" %message% \n [%bar%]"); |
184 | 184 | $progress->start(); |
185 | 185 | |
186 | - foreach($this->userManager->getBackends() as $backend) { |
|
186 | + foreach ($this->userManager->getBackends() as $backend) { |
|
187 | 187 | $limit = 500; |
188 | 188 | $offset = 0; |
189 | 189 | do { |
190 | 190 | $users = $backend->getUsers('', $limit, $offset); |
191 | 191 | foreach ($users as $user) { |
192 | 192 | if ($this->keyManager->userHasKeys($user) === false) { |
193 | - $progress->setMessage('Create key-pair for ' . $user); |
|
193 | + $progress->setMessage('Create key-pair for '.$user); |
|
194 | 194 | $progress->advance(); |
195 | 195 | $this->setupUserFS($user); |
196 | 196 | $password = $this->generateOneTimePassword($user); |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | } |
203 | 203 | } |
204 | 204 | $offset += $limit; |
205 | - } while(count($users) >= $limit); |
|
205 | + } while (count($users) >= $limit); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | $progress->setMessage('Key-pair created for all users'); |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | */ |
241 | 241 | protected function encryptAllUserFilesWithMasterKey(ProgressBar $progress) { |
242 | 242 | $userNo = 1; |
243 | - foreach($this->userManager->getBackends() as $backend) { |
|
243 | + foreach ($this->userManager->getBackends() as $backend) { |
|
244 | 244 | $limit = 500; |
245 | 245 | $offset = 0; |
246 | 246 | do { |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | $userNo++; |
252 | 252 | } |
253 | 253 | $offset += $limit; |
254 | - } while(count($users) >= $limit); |
|
254 | + } while (count($users) >= $limit); |
|
255 | 255 | } |
256 | 256 | } |
257 | 257 | |
@@ -266,19 +266,19 @@ discard block |
||
266 | 266 | |
267 | 267 | $this->setupUserFS($uid); |
268 | 268 | $directories = []; |
269 | - $directories[] = '/' . $uid . '/files'; |
|
269 | + $directories[] = '/'.$uid.'/files'; |
|
270 | 270 | |
271 | - while($root = array_pop($directories)) { |
|
271 | + while ($root = array_pop($directories)) { |
|
272 | 272 | $content = $this->rootView->getDirectoryContent($root); |
273 | 273 | foreach ($content as $file) { |
274 | - $path = $root . '/' . $file['name']; |
|
274 | + $path = $root.'/'.$file['name']; |
|
275 | 275 | if ($this->rootView->is_dir($path)) { |
276 | 276 | $directories[] = $path; |
277 | 277 | continue; |
278 | 278 | } else { |
279 | 279 | $progress->setMessage("encrypt files for user $userCount: $path"); |
280 | 280 | $progress->advance(); |
281 | - if($this->encryptFile($path) === false) { |
|
281 | + if ($this->encryptFile($path) === false) { |
|
282 | 282 | $progress->setMessage("encrypt files for user $userCount: $path (already encrypted)"); |
283 | 283 | $progress->advance(); |
284 | 284 | } |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | } |
303 | 303 | |
304 | 304 | $source = $path; |
305 | - $target = $path . '.encrypted.' . time(); |
|
305 | + $target = $path.'.encrypted.'.time(); |
|
306 | 306 | |
307 | 307 | try { |
308 | 308 | $this->rootView->copy($source, $target); |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | continue; |
425 | 425 | } |
426 | 426 | |
427 | - $subject = (string)$this->l->t('one-time password for server-side-encryption'); |
|
427 | + $subject = (string) $this->l->t('one-time password for server-side-encryption'); |
|
428 | 428 | list($htmlBody, $textBody) = $this->createMailBody($password); |
429 | 429 | |
430 | 430 | // send it out now |
@@ -472,11 +472,11 @@ discard block |
||
472 | 472 | protected function createMailBody($password) { |
473 | 473 | |
474 | 474 | $html = new \OC_Template("encryption", "mail", ""); |
475 | - $html->assign ('password', $password); |
|
475 | + $html->assign('password', $password); |
|
476 | 476 | $htmlMail = $html->fetchPage(); |
477 | 477 | |
478 | 478 | $plainText = new \OC_Template("encryption", "altmail", ""); |
479 | - $plainText->assign ('password', $password); |
|
479 | + $plainText->assign('password', $password); |
|
480 | 480 | $plainTextMail = $plainText->fetchPage(); |
481 | 481 | |
482 | 482 | return [$htmlMail, $plainTextMail]; |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | // for backward compatibility make sure that the remote url stored in the |
184 | 184 | // database ends with a trailing slash |
185 | 185 | if (substr($remote, -1) !== '/') { |
186 | - $remote = $remote . '/'; |
|
186 | + $remote = $remote.'/'; |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | $token = $share->getShareSecret(); |
@@ -211,23 +211,23 @@ discard block |
||
211 | 211 | |
212 | 212 | // FIXME this should be a method in the user management instead |
213 | 213 | if ($shareType === Share::SHARE_TYPE_USER) { |
214 | - $this->logger->debug('shareWith before, ' . $shareWith, ['app' => 'files_sharing']); |
|
214 | + $this->logger->debug('shareWith before, '.$shareWith, ['app' => 'files_sharing']); |
|
215 | 215 | Util::emitHook( |
216 | 216 | '\OCA\Files_Sharing\API\Server2Server', |
217 | 217 | 'preLoginNameUsedAsUserName', |
218 | 218 | ['uid' => &$shareWith] |
219 | 219 | ); |
220 | - $this->logger->debug('shareWith after, ' . $shareWith, ['app' => 'files_sharing']); |
|
220 | + $this->logger->debug('shareWith after, '.$shareWith, ['app' => 'files_sharing']); |
|
221 | 221 | |
222 | 222 | if (!$this->userManager->userExists($shareWith)) { |
223 | - throw new ProviderCouldNotAddShareException('User does not exists', '',Http::STATUS_BAD_REQUEST); |
|
223 | + throw new ProviderCouldNotAddShareException('User does not exists', '', Http::STATUS_BAD_REQUEST); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | \OC_Util::setupFS($shareWith); |
227 | 227 | } |
228 | 228 | |
229 | 229 | if ($shareType === Share::SHARE_TYPE_GROUP && !$this->groupManager->groupExists($shareWith)) { |
230 | - throw new ProviderCouldNotAddShareException('Group does not exists', '',Http::STATUS_BAD_REQUEST); |
|
230 | + throw new ProviderCouldNotAddShareException('Group does not exists', '', Http::STATUS_BAD_REQUEST); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | $externalManager = new \OCA\Files_Sharing\External\Manager( |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | ); |
246 | 246 | |
247 | 247 | try { |
248 | - $externalManager->addShare($remote, $token, '', $name, $owner, $shareType,false, $shareWith, $remoteId); |
|
248 | + $externalManager->addShare($remote, $token, '', $name, $owner, $shareType, false, $shareWith, $remoteId); |
|
249 | 249 | $shareId = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*share_external'); |
250 | 250 | |
251 | 251 | if ($shareType === Share::SHARE_TYPE_USER) { |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | ->setType('remote_share') |
255 | 255 | ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_RECEIVED, [$ownerFederatedId, trim($name, '/')]) |
256 | 256 | ->setAffectedUser($shareWith) |
257 | - ->setObject('remote_share', (int)$shareId, $name); |
|
257 | + ->setObject('remote_share', (int) $shareId, $name); |
|
258 | 258 | \OC::$server->getActivityManager()->publish($event); |
259 | 259 | $this->notifyAboutNewShare($shareWith, $shareId, $ownerFederatedId, $sharedByFederatedId, $name, $sharedBy, $owner); |
260 | 260 | } else { |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | ->setType('remote_share') |
266 | 266 | ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_RECEIVED, [$ownerFederatedId, trim($name, '/')]) |
267 | 267 | ->setAffectedUser($user->getUID()) |
268 | - ->setObject('remote_share', (int)$shareId, $name); |
|
268 | + ->setObject('remote_share', (int) $shareId, $name); |
|
269 | 269 | \OC::$server->getActivityManager()->publish($event); |
270 | 270 | $this->notifyAboutNewShare($user->getUID(), $shareId, $ownerFederatedId, $sharedByFederatedId, $name, $sharedBy, $owner); |
271 | 271 | } |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | 'level' => ILogger::ERROR, |
278 | 278 | 'app' => 'files_sharing' |
279 | 279 | ]); |
280 | - throw new ProviderCouldNotAddShareException('internal server error, was not able to add share from ' . $remote, '', HTTP::STATUS_INTERNAL_SERVER_ERROR); |
|
280 | + throw new ProviderCouldNotAddShareException('internal server error, was not able to add share from '.$remote, '', HTTP::STATUS_INTERNAL_SERVER_ERROR); |
|
281 | 281 | } |
282 | 282 | } |
283 | 283 | |
@@ -354,12 +354,12 @@ discard block |
||
354 | 354 | |
355 | 355 | $declineAction = $notification->createAction(); |
356 | 356 | $declineAction->setLabel('decline') |
357 | - ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'DELETE'); |
|
357 | + ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/'.$shareId)), 'DELETE'); |
|
358 | 358 | $notification->addAction($declineAction); |
359 | 359 | |
360 | 360 | $acceptAction = $notification->createAction(); |
361 | 361 | $acceptAction->setLabel('accept') |
362 | - ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'POST'); |
|
362 | + ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/'.$shareId)), 'POST'); |
|
363 | 363 | $notification->addAction($acceptAction); |
364 | 364 | |
365 | 365 | $this->notificationManager->notify($notification); |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | */ |
420 | 420 | protected function executeAcceptShare(IShare $share) { |
421 | 421 | try { |
422 | - $fileId = (int)$share->getNode()->getId(); |
|
422 | + $fileId = (int) $share->getNode()->getId(); |
|
423 | 423 | list($file, $link) = $this->getFile($this->getCorrectUid($share), $fileId); |
424 | 424 | } catch (\Exception $e) { |
425 | 425 | throw new ShareNotFound(); |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | $this->federatedShareProvider->removeShareFromTable($share); |
498 | 498 | |
499 | 499 | try { |
500 | - $fileId = (int)$share->getNode()->getId(); |
|
500 | + $fileId = (int) $share->getNode()->getId(); |
|
501 | 501 | list($file, $link) = $this->getFile($this->getCorrectUid($share), $fileId); |
502 | 502 | } catch (\Exception $e) { |
503 | 503 | throw new ShareNotFound(); |
@@ -592,10 +592,10 @@ discard block |
||
592 | 592 | // delete all child in case of a group share |
593 | 593 | $qb = $this->connection->getQueryBuilder(); |
594 | 594 | $qb->delete('share_external') |
595 | - ->where($qb->expr()->eq('parent', $qb->createNamedParameter((int)$share['id']))); |
|
595 | + ->where($qb->expr()->eq('parent', $qb->createNamedParameter((int) $share['id']))); |
|
596 | 596 | $qb->execute(); |
597 | 597 | |
598 | - if ((int)$share['share_type'] === Share::SHARE_TYPE_USER) { |
|
598 | + if ((int) $share['share_type'] === Share::SHARE_TYPE_USER) { |
|
599 | 599 | if ($share['accepted']) { |
600 | 600 | $path = trim($mountpoint, '/'); |
601 | 601 | } else { |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | $notification = $this->notificationManager->createNotification(); |
605 | 605 | $notification->setApp('files_sharing') |
606 | 606 | ->setUser($share['user']) |
607 | - ->setObject('remote_share', (int)$share['id']); |
|
607 | + ->setObject('remote_share', (int) $share['id']); |
|
608 | 608 | $this->notificationManager->markProcessed($notification); |
609 | 609 | |
610 | 610 | $event = $this->activityManager->generateEvent(); |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | ->setType('remote_share') |
613 | 613 | ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_UNSHARED, [$owner->getId(), $path]) |
614 | 614 | ->setAffectedUser($user) |
615 | - ->setObject('remote_share', (int)$share['id'], $path); |
|
615 | + ->setObject('remote_share', (int) $share['id'], $path); |
|
616 | 616 | \OC::$server->getActivityManager()->publish($event); |
617 | 617 | } |
618 | 618 | } |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | $owner = $share->getShareOwner(); |
662 | 662 | $currentServer = $this->addressHandler->generateRemoteURL(); |
663 | 663 | if ($this->addressHandler->compareAddresses($user, $remote, $owner, $currentServer)) { |
664 | - throw new ProviderCouldNotAddShareException('Resharing back to the owner is not allowed: ' . $id); |
|
664 | + throw new ProviderCouldNotAddShareException('Resharing back to the owner is not allowed: '.$id); |
|
665 | 665 | } |
666 | 666 | } catch (\Exception $e) { |
667 | 667 | throw new ProviderCouldNotAddShareException($e->getMessage()); |
@@ -675,10 +675,10 @@ discard block |
||
675 | 675 | $share->setSharedBy($share->getSharedWith()); |
676 | 676 | $share->setSharedWith($shareWith); |
677 | 677 | $result = $this->federatedShareProvider->create($share); |
678 | - $this->federatedShareProvider->storeRemoteId((int)$result->getId(), $senderId); |
|
678 | + $this->federatedShareProvider->storeRemoteId((int) $result->getId(), $senderId); |
|
679 | 679 | return ['token' => $result->getToken(), 'providerId' => $result->getId()]; |
680 | 680 | } else { |
681 | - throw new ProviderCouldNotAddShareException('resharing not allowed for share: ' . $id); |
|
681 | + throw new ProviderCouldNotAddShareException('resharing not allowed for share: '.$id); |
|
682 | 682 | } |
683 | 683 | |
684 | 684 | } |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | */ |
725 | 725 | protected function ocmPermissions2ncPermissions(array $ocmPermissions) { |
726 | 726 | $ncPermissions = 0; |
727 | - foreach($ocmPermissions as $permission) { |
|
727 | + foreach ($ocmPermissions as $permission) { |
|
728 | 728 | switch (strtolower($permission)) { |
729 | 729 | case 'read': |
730 | 730 | $ncPermissions += Constants::PERMISSION_READ; |
@@ -34,7 +34,7 @@ |
||
34 | 34 | } else { |
35 | 35 | http_response_code(307); |
36 | 36 | } |
37 | - header('Location: ' . $urlGenerator->linkToRoute($route, ['token' => $token])); |
|
37 | + header('Location: '.$urlGenerator->linkToRoute($route, ['token' => $token])); |
|
38 | 38 | } else { |
39 | 39 | http_response_code(404); |
40 | 40 | $tmpl = new OCP\Template('', '404', 'guest'); |