diff options
-rw-r--r-- | apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php | 11 | ||||
-rw-r--r-- | apps/dav/lib/CalDAV/Schedule/IMipPlugin.php | 36 | ||||
-rw-r--r-- | apps/encryption/lib/Crypto/Crypt.php | 2 | ||||
-rw-r--r-- | apps/files_external/lib/Lib/Storage/SFTPReadStream.php | 3 | ||||
-rw-r--r-- | core/Command/Log/Manage.php | 50 |
5 files changed, 44 insertions, 58 deletions
diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php index c2e68605d17..355d95057ff 100644 --- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php +++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php @@ -35,10 +35,10 @@ use DateTime; use OCP\IConfig; use OCP\IL10N; use OCP\IURLGenerator; +use OCP\IUser; use OCP\L10N\IFactory as L10NFactory; use OCP\Mail\IEMailTemplate; use OCP\Mail\IMailer; -use OCP\IUser; use Psr\Log\LoggerInterface; use Sabre\VObject; use Sabre\VObject\Component\VEvent; @@ -51,7 +51,6 @@ use Sabre\VObject\Property; * @package OCA\DAV\CalDAV\Reminder\NotificationProvider */ class EmailProvider extends AbstractProvider { - /** @var string */ public const NOTIFICATION_TYPE = 'EMAIL'; @@ -77,7 +76,7 @@ class EmailProvider extends AbstractProvider { */ public function send(VEvent $vevent, string $calendarDisplayName, - array $principalEmailAddresses, + array $principalEmailAddresses, array $users = []):void { $fallbackLanguage = $this->getFallbackLanguage(); @@ -202,7 +201,7 @@ class EmailProvider extends AbstractProvider { $organizerEMail = substr($organizer->getValue(), 7); - if ($organizerEMail === false || !$this->mailer->validateMailAddress($organizerEMail)) { + if (!$this->mailer->validateMailAddress($organizerEMail)) { return null; } @@ -273,7 +272,7 @@ class EmailProvider extends AbstractProvider { foreach ($emailAddressesOfDelegates as $addressesOfDelegate) { if (strcasecmp($addressesOfDelegate, 'mailto:') === 0) { $delegateEmail = substr($addressesOfDelegate, 7); - if ($delegateEmail !== false && $this->mailer->validateMailAddress($delegateEmail)) { + if ($this->mailer->validateMailAddress($delegateEmail)) { $emailAddresses[$delegateEmail] = []; } } @@ -333,7 +332,7 @@ class EmailProvider extends AbstractProvider { return null; } $attendeeEMail = substr($attendee->getValue(), 7); - if ($attendeeEMail === false || !$this->mailer->validateMailAddress($attendeeEMail)) { + if (!$this->mailer->validateMailAddress($attendeeEMail)) { return null; } diff --git a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php index 515072fd227..be238ae5afb 100644 --- a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php +++ b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php @@ -71,7 +71,6 @@ use Sabre\VObject\Recur\EventIterator; * @license http://sabre.io/license/ Modified BSD License */ class IMipPlugin extends SabreIMipPlugin { - /** @var string */ private $userId; @@ -138,7 +137,6 @@ class IMipPlugin extends SabreIMipPlugin { * @return void */ public function schedule(Message $iTipMessage) { - // Not sending any emails if the system considers the update // insignificant. if (!$iTipMessage->significantChange) { @@ -168,7 +166,7 @@ class IMipPlugin extends SabreIMipPlugin { // Strip off mailto: $sender = substr($iTipMessage->sender, 7); $recipient = substr($iTipMessage->recipient, 7); - if ($recipient === false || !$this->mailer->validateMailAddress($recipient)) { + if (!$this->mailer->validateMailAddress($recipient)) { // Nothing to send if the recipient doesn't have a valid email address $iTipMessage->scheduleStatus = '5.0; EMail delivery failed'; return; @@ -224,11 +222,8 @@ class IMipPlugin extends SabreIMipPlugin { $message = $this->mailer->createMessage() ->setFrom([$fromEMail => $fromName]) - ->setTo([$recipient => $recipientName]); - - if ($sender !== false) { - $message->setReplyTo([$sender => $senderName]); - } + ->setTo([$recipient => $recipientName]) + ->setReplyTo([$sender => $senderName]); $template = $this->mailer->createEMailTemplate('dav.calendarInvite.' . $method, $data); $template->addHeader(); @@ -240,7 +235,6 @@ class IMipPlugin extends SabreIMipPlugin { // Only add response buttons to invitation requests: Fix Issue #11230 if (($method == self::METHOD_REQUEST) && $this->getAttendeeRsvpOrReqForParticipant($attendee)) { - /* ** Only offer invitation accept/reject buttons, which link back to the ** nextcloud server, to recipients who can access the nextcloud server via @@ -530,25 +524,25 @@ class IMipPlugin extends SabreIMipPlugin { private function addBulletList(IEMailTemplate $template, IL10N $l10n, $vevent) { if ($vevent->SUMMARY) { $template->addBodyListItem($vevent->SUMMARY, $l10n->t('Title:'), - $this->getAbsoluteImagePath('caldav/title.png'),'','',self::IMIP_INDENT); + $this->getAbsoluteImagePath('caldav/title.png'), '', '', self::IMIP_INDENT); } $meetingWhen = $this->generateWhenString($l10n, $vevent); if ($meetingWhen) { $template->addBodyListItem($meetingWhen, $l10n->t('Time:'), - $this->getAbsoluteImagePath('caldav/time.png'),'','',self::IMIP_INDENT); + $this->getAbsoluteImagePath('caldav/time.png'), '', '', self::IMIP_INDENT); } if ($vevent->LOCATION) { $template->addBodyListItem($vevent->LOCATION, $l10n->t('Location:'), - $this->getAbsoluteImagePath('caldav/location.png'),'','',self::IMIP_INDENT); + $this->getAbsoluteImagePath('caldav/location.png'), '', '', self::IMIP_INDENT); } if ($vevent->URL) { $url = $vevent->URL->getValue(); $template->addBodyListItem(sprintf('<a href="%s">%s</a>', - htmlspecialchars($url), - htmlspecialchars($url)), + htmlspecialchars($url), + htmlspecialchars($url)), $l10n->t('Link:'), $this->getAbsoluteImagePath('caldav/link.png'), - $url,'',self::IMIP_INDENT); + $url, '', self::IMIP_INDENT); } $this->addAttendees($template, $l10n, $vevent); @@ -556,7 +550,7 @@ class IMipPlugin extends SabreIMipPlugin { /* Put description last, like an email body, since it can be arbitrarily long */ if ($vevent->DESCRIPTION) { $template->addBodyListItem($vevent->DESCRIPTION->getValue(), $l10n->t('Description:'), - $this->getAbsoluteImagePath('caldav/description.png'),'','',self::IMIP_INDENT); + $this->getAbsoluteImagePath('caldav/description.png'), '', '', self::IMIP_INDENT); } } @@ -586,7 +580,7 @@ class IMipPlugin extends SabreIMipPlugin { /** @var Property\ICalendar\CalAddress $organizer */ $organizer = $vevent->ORGANIZER; $organizerURI = $organizer->getNormalizedValue(); - [$scheme,$organizerEmail] = explode(':',$organizerURI,2); # strip off scheme mailto: + [$scheme,$organizerEmail] = explode(':', $organizerURI, 2); # strip off scheme mailto: /** @var string|null $organizerName */ $organizerName = isset($organizer['CN']) ? $organizer['CN'] : null; $organizerHTML = sprintf('<a href="%s">%s</a>', @@ -603,7 +597,7 @@ class IMipPlugin extends SabreIMipPlugin { } $template->addBodyListItem($organizerHTML, $l10n->t('Organizer:'), $this->getAbsoluteImagePath('caldav/organizer.png'), - $organizerText,'',self::IMIP_INDENT); + $organizerText, '', self::IMIP_INDENT); } $attendees = $vevent->select('ATTENDEE'); @@ -615,7 +609,7 @@ class IMipPlugin extends SabreIMipPlugin { $attendeesText = []; foreach ($attendees as $attendee) { $attendeeURI = $attendee->getNormalizedValue(); - [$scheme,$attendeeEmail] = explode(':',$attendeeURI,2); # strip off scheme mailto: + [$scheme,$attendeeEmail] = explode(':', $attendeeURI, 2); # strip off scheme mailto: $attendeeName = isset($attendee['CN']) ? $attendee['CN'] : null; $attendeeHTML = sprintf('<a href="%s">%s</a>', htmlspecialchars($attendeeURI), @@ -630,9 +624,9 @@ class IMipPlugin extends SabreIMipPlugin { array_push($attendeesText, $attendeeText); } - $template->addBodyListItem(implode('<br/>',$attendeesHTML), $l10n->t('Attendees:'), + $template->addBodyListItem(implode('<br/>', $attendeesHTML), $l10n->t('Attendees:'), $this->getAbsoluteImagePath('caldav/attendees.png'), - implode("\n",$attendeesText),'',self::IMIP_INDENT); + implode("\n", $attendeesText), '', self::IMIP_INDENT); } /** diff --git a/apps/encryption/lib/Crypto/Crypt.php b/apps/encryption/lib/Crypto/Crypt.php index 7429c613b52..8bfeb0c7a68 100644 --- a/apps/encryption/lib/Crypto/Crypt.php +++ b/apps/encryption/lib/Crypto/Crypt.php @@ -160,7 +160,7 @@ class Crypt { /** * Generates a new private key * - * @return resource + * @return \OpenSSLAsymmetricKey|false */ public function getOpenSSLPKey() { $config = $this->getOpenSSLConfig(); diff --git a/apps/files_external/lib/Lib/Storage/SFTPReadStream.php b/apps/files_external/lib/Lib/Storage/SFTPReadStream.php index 680a51cfa10..c4749b15453 100644 --- a/apps/files_external/lib/Lib/Storage/SFTPReadStream.php +++ b/apps/files_external/lib/Lib/Storage/SFTPReadStream.php @@ -136,9 +136,6 @@ class SFTPReadStream implements File { $data = substr($this->buffer, 0, $count); $this->buffer = substr($this->buffer, $count); - if ($this->buffer === false) { - $this->buffer = ''; - } $this->readPosition += strlen($data); return $data; diff --git a/core/Command/Log/Manage.php b/core/Command/Log/Manage.php index 34ec5ea54a8..63a8efde370 100644 --- a/core/Command/Log/Manage.php +++ b/core/Command/Log/Manage.php @@ -141,18 +141,18 @@ class Manage extends Command implements CompletionAwareInterface { protected function convertLevelString($level) { $level = strtolower($level); switch ($level) { - case 'debug': - return 0; - case 'info': - return 1; - case 'warning': - case 'warn': - return 2; - case 'error': - case 'err': - return 3; - case 'fatal': - return 4; + case 'debug': + return 0; + case 'info': + return 1; + case 'warning': + case 'warn': + return 2; + case 'error': + case 'err': + return 3; + case 'fatal': + return 4; } throw new \InvalidArgumentException('Invalid log level string'); } @@ -164,16 +164,16 @@ class Manage extends Command implements CompletionAwareInterface { */ protected function convertLevelNumber($levelNum) { switch ($levelNum) { - case 0: - return 'Debug'; - case 1: - return 'Info'; - case 2: - return 'Warning'; - case 3: - return 'Error'; - case 4: - return 'Fatal'; + case 0: + return 'Debug'; + case 1: + return 'Info'; + case 2: + return 'Warning'; + case 3: + return 'Error'; + case 4: + return 'Fatal'; } throw new \InvalidArgumentException('Invalid log level number'); } @@ -189,11 +189,7 @@ class Manage extends Command implements CompletionAwareInterface { } elseif ($optionName === 'level') { return ['debug', 'info', 'warning', 'error', 'fatal']; } elseif ($optionName === 'timezone') { - $identifier = \DateTimeZone::listIdentifiers(); - if ($identifier === false) { - return []; - } - return $identifier; + return \DateTimeZone::listIdentifiers(); } return []; } |