diff options
author | Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> | 2020-05-26 08:43:40 +0300 |
---|---|---|
committer | Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> | 2020-05-26 08:43:40 +0300 |
commit | cf14edf2089040c7cfc2bec347084c30818aba8f (patch) | |
tree | b70de37839c1f3ed062e2d6f9bc694188b2a91b4 /lib | |
parent | 2396f8326ca2f9d1b2320e6381e26981b902586b (diff) |
Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Controller/OptionController.php | 2 | ||||
-rw-r--r-- | lib/Controller/PollController.php | 8 | ||||
-rw-r--r-- | lib/Controller/SystemController.php | 2 | ||||
-rw-r--r-- | lib/Migration/Version0104Date20200205104800.php | 80 | ||||
-rw-r--r-- | lib/Service/MailService.php | 4 |
5 files changed, 48 insertions, 48 deletions
diff --git a/lib/Controller/OptionController.php b/lib/Controller/OptionController.php index 9180d1a0..88c64202 100644 --- a/lib/Controller/OptionController.php +++ b/lib/Controller/OptionController.php @@ -192,7 +192,7 @@ class OptionController extends Controller { if ($option['confirmed']) { // do not update confirmation date, if option is already confirmed - if (!$updateOption->getConfirmed()){ + if (!$updateOption->getConfirmed()) { $updateOption->setConfirmed(time()); } diff --git a/lib/Controller/PollController.php b/lib/Controller/PollController.php index 601bc9ec..9b535fe0 100644 --- a/lib/Controller/PollController.php +++ b/lib/Controller/PollController.php @@ -143,7 +143,7 @@ // TODO: Not the elegant way. Improvement neccessary foreach ($polls as $poll) { $combinedPoll = (object) array_merge( - (array) json_decode(json_encode($poll)), (array) json_decode(json_encode($this->acl->setPollId($poll->getId())))); + (array) json_decode(json_encode($poll)), (array) json_decode(json_encode($this->acl->setPollId($poll->getId())))); if ($combinedPoll->allowView) { $pollList[] = $combinedPoll; } @@ -189,7 +189,7 @@ } if ($this->acl->getAllowSeeUsernames()) { - $comments = $this->commentMapper->findByPoll($pollId); + $comments = $this->commentMapper->findByPoll($pollId); if ($this->acl->getAllowSeeResults()) { $votes = $this->voteMapper->findByPoll($pollId); @@ -290,8 +290,8 @@ } if (!$this->poll->getDeleted()) { - $this->logger->alert('user ' . $this->userId . ' trying to permanently delete active poll'); - return new DataResponse(['message' => 'Permanent deletion of active poll.'], Http::STATUS_CONFLICT); + $this->logger->alert('user ' . $this->userId . ' trying to permanently delete active poll'); + return new DataResponse(['message' => 'Permanent deletion of active poll.'], Http::STATUS_CONFLICT); } $this->pollMapper->delete($this->poll); diff --git a/lib/Controller/SystemController.php b/lib/Controller/SystemController.php index d718e53e..ad091d6e 100644 --- a/lib/Controller/SystemController.php +++ b/lib/Controller/SystemController.php @@ -88,7 +88,7 @@ class SystemController extends Controller { * @return Boolval */ private function isValidEmail($email) { - return (!preg_match('/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/', $email)) ? FALSE : TRUE; + return (!preg_match('/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/', $email)) ? false : true; } /** diff --git a/lib/Migration/Version0104Date20200205104800.php b/lib/Migration/Version0104Date20200205104800.php index ecc00280..32fe2217 100644 --- a/lib/Migration/Version0104Date20200205104800.php +++ b/lib/Migration/Version0104Date20200205104800.php @@ -42,15 +42,15 @@ class Version0104Date20200205104800 extends SimpleMigrationStep { /** @var IConfig */ protected $config; - /** @var array */ - protected $childTables = [ - 'polls_comments', - 'polls_log', - 'polls_notif', - 'polls_options', - 'polls_share', - 'polls_votes', - ]; + /** @var array */ + protected $childTables = [ + 'polls_comments', + 'polls_log', + 'polls_notif', + 'polls_options', + 'polls_share', + 'polls_votes', + ]; /** * @param IDBConnection $connection @@ -62,37 +62,37 @@ class Version0104Date20200205104800 extends SimpleMigrationStep { } - /** - * @param IOutput $output - * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` - * @param array $options - * @return null - * @since 13.0.0 - */ - public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { - // delete all orphaned entries by selecting all rows - // those poll_ids are not present in the polls table - // - // we have to use a raw query, because NOT EXISTS is not - // part of doctrine's expression builder - // - // get table prefix, as we are running a raw query - $prefix = $this->config->getSystemValue('dbtableprefix', 'oc_'); - // check for orphaned entries in all tables referencing - // the main polls table - foreach($this->childTables as $tbl) { - $child = "$prefix$tbl"; - $query = "DELETE + /** + * @param IOutput $output + * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` + * @param array $options + * @return null + * @since 13.0.0 + */ + public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { + // delete all orphaned entries by selecting all rows + // those poll_ids are not present in the polls table + // + // we have to use a raw query, because NOT EXISTS is not + // part of doctrine's expression builder + // + // get table prefix, as we are running a raw query + $prefix = $this->config->getSystemValue('dbtableprefix', 'oc_'); + // check for orphaned entries in all tables referencing + // the main polls table + foreach($this->childTables as $tbl) { + $child = "$prefix$tbl"; + $query = "DELETE FROM $child WHERE NOT EXISTS ( SELECT NULL FROM {$prefix}polls_polls polls WHERE polls.id = {$child}.poll_id )"; - $stmt = $this->connection->prepare($query); - $stmt->execute(); - } - } + $stmt = $this->connection->prepare($query); + $stmt->execute(); + } + } /** * @param IOutput $output @@ -102,16 +102,16 @@ class Version0104Date20200205104800 extends SimpleMigrationStep { * @since 13.0.0 */ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { - // add an on delete fk contraint to all tables referencing the main polls table + // add an on delete fk contraint to all tables referencing the main polls table /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); - $eventTable = $schema->getTable('polls_polls'); - foreach($this->childTables as $tbl) { - $table = $schema->getTable($tbl); + $eventTable = $schema->getTable('polls_polls'); + foreach($this->childTables as $tbl) { + $table = $schema->getTable($tbl); - $table->addForeignKeyConstraint($eventTable, ['poll_id'], ['id'], ['onDelete' => 'CASCADE']); - } + $table->addForeignKeyConstraint($eventTable, ['poll_id'], ['id'], ['onDelete' => 'CASCADE']); + } return $schema; } diff --git a/lib/Service/MailService.php b/lib/Service/MailService.php index 7d0046c1..b285b99b 100644 --- a/lib/Service/MailService.php +++ b/lib/Service/MailService.php @@ -288,8 +288,8 @@ class MailService { $recipient['link'] ); - $emailTemplate->addBodyText( $trans->t('This link gives you personal access to the poll named above. Press the button above or copy the following link and add it in your browser\'s location bar: ') ); - $emailTemplate->addBodyText( $recipient['link'] ); + $emailTemplate->addBodyText($trans->t('This link gives you personal access to the poll named above. Press the button above or copy the following link and add it in your browser\'s location bar: ')); + $emailTemplate->addBodyText($recipient['link']); $emailTemplate->addFooter($trans->t('This email is sent to you, because you are invited to vote in this poll by the poll owner. At least your name or your email address is recorded in this poll. If you want to get removed from this poll, contact the site administrator or the initiator of this poll, where the mail is sent from.')); |