diff options
author | dartcafe <github@dartcafe.de> | 2018-05-03 23:08:09 +0300 |
---|---|---|
committer | dartcafe <github@dartcafe.de> | 2018-05-03 23:08:09 +0300 |
commit | d4b2824cb4acf5198038f5beaf9270b90225a9e4 (patch) | |
tree | 51da1105c4f8b1773f919281902e07b3e1f1ebb9 /lib | |
parent | 7496d9aca9458357d67de7c6d9eb611610479dc6 (diff) |
fixes
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AppInfo/Application.php | 24 | ||||
-rw-r--r-- | lib/Controller/ApiController.php | 24 | ||||
-rw-r--r-- | lib/Controller/PageController.php | 6 | ||||
-rw-r--r-- | lib/Migration/Version009000Date20171202105141.php | 6 |
4 files changed, 32 insertions, 28 deletions
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 346ba0b1..dca24e7e 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -47,7 +47,7 @@ class Application extends App { /** * Controllers */ - $container->registerService('PageController', function (IContainer $c) { + $container->registerService('PageController', function(IContainer $c) { return new PageController( $c->query('AppName'), $c->query('Request'), @@ -66,51 +66,51 @@ class Application extends App { ); }); - $container->registerService('UserManager', function (IContainer $c) { + $container->registerService('UserManager', function(IContainer $c) { return $c->query('ServerContainer')->getUserManager(); }); - $container->registerService('GroupManager', function (IContainer $c) { + $container->registerService('GroupManager', function(IContainer $c) { return $c->query('ServerContainer')->getGroupManager(); }); - $container->registerService('AvatarManager', function (IContainer $c) { + $container->registerService('AvatarManager', function(IContainer $c) { return $c->query('ServerContainer')->getAvatarManager(); }); - $container->registerService('Logger', function (IContainer $c) { + $container->registerService('Logger', function(IContainer $c) { return $c->query('ServerContainer')->getLogger(); }); - $container->registerService('L10N', function (IContainer $c) { + $container->registerService('L10N', function(IContainer $c) { return $c->query('ServerContainer')->getL10N($c->query('AppName')); }); - $container->registerService('CommentMapper', function (IContainer $c) use ($server) { + $container->registerService('CommentMapper', function(IContainer $c) use ($server) { return new CommentMapper( $server->getDatabaseConnection() ); }); - $container->registerService('OptionsMapper', function (IContainer $c) use ($server) { + $container->registerService('OptionsMapper', function(IContainer $c) use ($server) { return new OptionsMapper( $server->getDatabaseConnection() ); }); - $container->registerService('EventMapper', function (IContainer $c) use ($server) { + $container->registerService('EventMapper', function(IContainer $c) use ($server) { return new EventMapper( $server->getDatabaseConnection() ); }); - $container->registerService('NotificationMapper', function (IContainer $c) use ($server) { + $container->registerService('NotificationMapper', function(IContainer $c) use ($server) { return new NotificationMapper( $server->getDatabaseConnection() ); }); - $container->registerService('VotesMapper', function (IContainer $c) use ($server) { + $container->registerService('VotesMapper', function(IContainer $c) use ($server) { return new VotesMapper( $server->getDatabaseConnection() ); @@ -122,7 +122,7 @@ class Application extends App { */ public function registerNavigationEntry() { $container = $this->getContainer(); - $container->query('OCP\INavigationManager')->add(function () use ($container) { + $container->query('OCP\INavigationManager')->add(function() use ($container) { $urlGenerator = $container->query('OCP\IURLGenerator'); $l10n = $container->query('OCP\IL10N'); return [ diff --git a/lib/Controller/ApiController.php b/lib/Controller/ApiController.php index d240ddf2..8b4587d6 100644 --- a/lib/Controller/ApiController.php +++ b/lib/Controller/ApiController.php @@ -74,12 +74,12 @@ class ApiController extends Controller { } /** - * @NoAdminRequired - * @NoCSRFRequired - * @PublicPage - * @param string $hash - * @return JSONResponse - */ + * @NoAdminRequired + * @NoCSRFRequired + * @PublicPage + * @param string $hash + * @return JSONResponse + */ public function getPoll($hash) { try { $poll = $this->eventMapper->findByHash($hash); @@ -134,7 +134,7 @@ class ApiController extends Controller { $expiration = true; $expire = $poll->getExpire(); } - If ($poll->getOwner() !== $this->userId) { + if ($poll->getOwner() !== $this->userId) { $mode = 'create'; } else { $mode = 'edit'; @@ -179,7 +179,7 @@ class ApiController extends Controller { $newEvent = new Event(); - If ($mode === 'edit') { + if ($mode === 'edit') { // Existing poll shall be edited $oldPoll = $this->eventMapper->findByHash($event['hash']); @@ -232,7 +232,7 @@ class ApiController extends Controller { $this->eventMapper->update($newEvent); $this->optionsMapper->deleteByPoll($newEvent->getId()); - } else if ($mode === 'create'){ + } else if ($mode === 'create') { $newEvent = $this->eventMapper->insert($newEvent); /* $ins = $this->eventMapper->insert($newEvent); $newEvent->setId($ins->getId()); @@ -259,6 +259,10 @@ class ApiController extends Controller { } } - return new JSONResponse(json_encode($options.pollTexts)); + return new JSONResponse( json_encode(array( + 'id' => $newEvent->getId(), + 'hash' => $newEvent->getHash() + ))); + } } diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 4ed336bc..f0ae14e5 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -347,7 +347,7 @@ class PageController extends Controller { foreach ($optionsArray as $optionElement) { $option = new Options(); $option->setPollId($pollId); - $option->setPollOptionText(date('Y-m-d H:i:s', (int)$optionElement)); + $option->setPollOptionText(date('Y-m-d H:i:s', (int) $optionElement)); $this->optionsMapper->insert($option); } } else { @@ -557,7 +557,7 @@ class PageController extends Controller { return new JSONResponse(array( 'userId' => $userId, 'displayName' => $displayName, - 'timeStamp' => $timeStamp *100, + 'timeStamp' => $timeStamp * 100, 'date' => date('Y-m-d H:i:s', $timeStamp), 'relativeNow' => $this->trans->t('just now'), 'comment' => $commentBox @@ -656,7 +656,7 @@ class PageController extends Controller { } // Nextcloud >= 12 $groups = $this->groupManager->getUserGroups(\OC::$server->getUserSession()->getUser()); - return array_map(function ($group) { + return array_map(function($group) { return $group->getGID(); }, $groups); } diff --git a/lib/Migration/Version009000Date20171202105141.php b/lib/Migration/Version009000Date20171202105141.php index e5fd3068..4aac830a 100644 --- a/lib/Migration/Version009000Date20171202105141.php +++ b/lib/Migration/Version009000Date20171202105141.php @@ -122,7 +122,7 @@ class Version009000Date20171202105141 extends SimpleMigrationStep { 'notnull' => false, ]); $table->addColumn('poll_option_text', Type::STRING, [ - 'notnull' => false, // maybe true? + 'notnull' => false, // maybe true? 'length' => 256, ]); $table->setPrimaryKey(['id']); @@ -352,8 +352,8 @@ class Version009000Date20171202105141 extends SimpleMigrationStep { ->from('polls_options') // ->where($queryFind->expr()->eq('poll_id', $pollId)) // ->andWhere($queryFind->expr()->eq('poll_option', $text)); - ->where('poll_id = "'. $pollId .'"') - ->andWhere('poll_option_text ="' .$text .'"'); + ->where('poll_id = "' . $pollId . '"') + ->andWhere('poll_option_text ="' . $text .'"'); $resultFind = $queryFind->execute(); $row = $resultFind->fetch(); |