@@ -21,7 +21,7 @@ |
||
21 | 21 | * |
22 | 22 | */ |
23 | 23 | |
24 | -if ((@include_once __DIR__ . '/../vendor/autoload.php')===false) { |
|
24 | +if ((@include_once __DIR__ . '/../vendor/autoload.php') === false) { |
|
25 | 25 | throw new Exception('Cannot include autoload. Did you run install dependencies using composer?'); |
26 | 26 | } |
27 | 27 |
@@ -45,6 +45,9 @@ |
||
45 | 45 | return $this->findEntity($sql, [$id]); |
46 | 46 | } |
47 | 47 | |
48 | + /** |
|
49 | + * @param string $sql |
|
50 | + */ |
|
48 | 51 | protected function execute($sql, array $params = [], $limit = null, $offset = null) { |
49 | 52 | return parent::execute($sql, $params, $limit, $offset); |
50 | 53 | } |
@@ -66,6 +66,9 @@ discard block |
||
66 | 66 | return $result; |
67 | 67 | } |
68 | 68 | |
69 | + /** |
|
70 | + * @param integer $labelId |
|
71 | + */ |
|
69 | 72 | public function deleteLabelAssignments($labelId) { |
70 | 73 | $sql = 'DELETE FROM `*PREFIX*deck_assigned_labels` WHERE label_id = ?'; |
71 | 74 | $stmt = $this->db->prepare($sql); |
@@ -73,6 +76,9 @@ discard block |
||
73 | 76 | $stmt->execute(); |
74 | 77 | } |
75 | 78 | |
79 | + /** |
|
80 | + * @param integer $cardId |
|
81 | + */ |
|
76 | 82 | public function deleteLabelAssignmentsForCard($cardId) { |
77 | 83 | $sql = 'DELETE FROM `*PREFIX*deck_assigned_labels` WHERE card_id = ?'; |
78 | 84 | $stmt = $this->db->prepare($sql); |
@@ -124,7 +124,7 @@ |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
127 | - * @param $subjectIdentifier |
|
127 | + * @param string $subjectIdentifier |
|
128 | 128 | * @param array $subjectParams |
129 | 129 | * @param bool $ownActivity |
130 | 130 | * @return string |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $subject = ''; |
134 | 134 | switch ($subjectIdentifier) { |
135 | 135 | case self::SUBJECT_BOARD_CREATE: |
136 | - $subject = $ownActivity ? $this->l10n->t('You have created a new board {board}'): $this->l10n->t('{user} has created a new board {board}'); |
|
136 | + $subject = $ownActivity ? $this->l10n->t('You have created a new board {board}') : $this->l10n->t('{user} has created a new board {board}'); |
|
137 | 137 | break; |
138 | 138 | case self::SUBJECT_BOARD_DELETE: |
139 | 139 | $subject = $ownActivity ? $this->l10n->t('You have deleted the board {board}') : $this->l10n->t('{user} has deleted the board {board}'); |
@@ -302,10 +302,10 @@ discard block |
||
302 | 302 | try { |
303 | 303 | $object = $this->findObjectForEntity($objectType, $entity); |
304 | 304 | } catch (DoesNotExistException $e) { |
305 | - \OC::$server->getLogger()->error('Could not create activity entry for ' . $subject . '. Entity not found.', (array)$entity); |
|
305 | + \OC::$server->getLogger()->error('Could not create activity entry for ' . $subject . '. Entity not found.', (array) $entity); |
|
306 | 306 | return null; |
307 | 307 | } catch (MultipleObjectsReturnedException $e) { |
308 | - \OC::$server->getLogger()->error('Could not create activity entry for ' . $subject . '. Entity not found.', (array)$entity); |
|
308 | + \OC::$server->getLogger()->error('Could not create activity entry for ' . $subject . '. Entity not found.', (array) $entity); |
|
309 | 309 | return null; |
310 | 310 | } |
311 | 311 | |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | break; |
376 | 376 | } |
377 | 377 | |
378 | - if ($subject === self::SUBJECT_CARD_UPDATE_DESCRIPTION){ |
|
378 | + if ($subject === self::SUBJECT_CARD_UPDATE_DESCRIPTION) { |
|
379 | 379 | $card = $subjectParams['card']; |
380 | 380 | if ($card->getLastEditor() === $this->userId) { |
381 | 381 | return null; |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | $event->setApp('deck') |
395 | 395 | ->setType($eventType) |
396 | 396 | ->setAuthor($author === null ? $this->userId : $author) |
397 | - ->setObject($objectType, (int)$object->getId(), $object->getTitle()) |
|
397 | + ->setObject($objectType, (int) $object->getId(), $object->getTitle()) |
|
398 | 398 | ->setSubject($subject, array_merge($subjectParams, $additionalParams)) |
399 | 399 | ->setTimestamp(time()); |
400 | 400 | |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | $objectId = $entity->getObjectId(); |
456 | 456 | break; |
457 | 457 | default: |
458 | - throw new InvalidArgumentException('No entity relation present for '. $className . ' to ' . $objectType); |
|
458 | + throw new InvalidArgumentException('No entity relation present for ' . $className . ' to ' . $objectType); |
|
459 | 459 | } |
460 | 460 | return $this->cardMapper->find($objectId); |
461 | 461 | } |
@@ -470,11 +470,11 @@ discard block |
||
470 | 470 | $objectId = $entity->getBoardId(); |
471 | 471 | break; |
472 | 472 | default: |
473 | - throw new InvalidArgumentException('No entity relation present for '. $className . ' to ' . $objectType); |
|
473 | + throw new InvalidArgumentException('No entity relation present for ' . $className . ' to ' . $objectType); |
|
474 | 474 | } |
475 | 475 | return $this->boardMapper->find($objectId); |
476 | 476 | } |
477 | - throw new InvalidArgumentException('No entity relation present for '. $className . ' to ' . $objectType); |
|
477 | + throw new InvalidArgumentException('No entity relation present for ' . $className . ' to ' . $objectType); |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | private function findDetailsForStack($stackId) { |
@@ -91,8 +91,8 @@ |
||
91 | 91 | $card->setLabels($this->labelMapper->findAssignedLabelsForCard($cardId)); |
92 | 92 | $card->setAttachmentCount($this->attachmentService->count($cardId)); |
93 | 93 | $user = $this->userManager->get($this->currentUser); |
94 | - $lastRead = $this->commentsManager->getReadMark('deckCard', (string)$card->getId(), $user); |
|
95 | - $count = $this->commentsManager->getNumberOfCommentsForObject('deckCard', (string)$card->getId(), $lastRead); |
|
94 | + $lastRead = $this->commentsManager->getReadMark('deckCard', (string) $card->getId(), $user); |
|
95 | + $count = $this->commentsManager->getNumberOfCommentsForObject('deckCard', (string) $card->getId(), $lastRead); |
|
96 | 96 | $card->setCommentsUnread($count); |
97 | 97 | } |
98 | 98 |
@@ -23,13 +23,9 @@ |
||
23 | 23 | |
24 | 24 | namespace OCA\Deck\Db; |
25 | 25 | |
26 | -use OCP\AppFramework\Db\DoesNotExistException; |
|
27 | -use OCP\ICache; |
|
28 | 26 | use OCP\ICacheFactory; |
29 | 27 | use OCP\IDBConnection; |
30 | 28 | use OCP\IRequest; |
31 | -use OCP\IUserManager; |
|
32 | -use OCP\IGroupManager; |
|
33 | 29 | |
34 | 30 | class ChangeHelper { |
35 | 31 |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | public function cardChanged($cardId, $updateCard = true) { |
62 | 62 | $time = time(); |
63 | 63 | $etag = md5($time . microtime()); |
64 | - $this->cache->set(self::TYPE_CARD . '-' .$cardId, $etag); |
|
64 | + $this->cache->set(self::TYPE_CARD . '-' . $cardId, $etag); |
|
65 | 65 | if ($updateCard) { |
66 | 66 | $sql = 'UPDATE `*PREFIX*deck_cards` SET `last_modified` = ?, `last_editor` = ? WHERE `id` = ?'; |
67 | 67 | $this->db->executeUpdate($sql, [time(), $this->userId, $cardId]); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | public function stackChanged($stackId, $updateBoard = true) { |
79 | 79 | $time = time(); |
80 | 80 | $etag = md5($time . microtime()); |
81 | - $this->cache->set(self::TYPE_CARD . '-' .$stackId, $etag); |
|
81 | + $this->cache->set(self::TYPE_CARD . '-' . $stackId, $etag); |
|
82 | 82 | if ($updateBoard) { |
83 | 83 | $sql = 'UPDATE `*PREFIX*deck_stacks` SET `last_modified` = ? WHERE `id` = ?'; |
84 | 84 | $this->db->executeUpdate($sql, [time(), $stackId]); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | } |
95 | 95 | |
96 | 96 | public function getEtag($type, $id) { |
97 | - $entry = $this->cache->get($type . '-' .$id); |
|
97 | + $entry = $this->cache->get($type . '-' . $id); |
|
98 | 98 | if ($entry === 'null') { |
99 | 99 | return ''; |
100 | 100 | } |
@@ -31,76 +31,76 @@ |
||
31 | 31 | |
32 | 32 | class AttachmentApiController extends ApiController { |
33 | 33 | |
34 | - private $attachmentService; |
|
34 | + private $attachmentService; |
|
35 | 35 | |
36 | - public function __construct($appName, IRequest $request, AttachmentService $attachmentService) { |
|
37 | - parent::__construct($appName, $request); |
|
38 | - $this->attachmentService = $attachmentService; |
|
39 | - } |
|
36 | + public function __construct($appName, IRequest $request, AttachmentService $attachmentService) { |
|
37 | + parent::__construct($appName, $request); |
|
38 | + $this->attachmentService = $attachmentService; |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
41 | + /** |
|
42 | 42 | * @NoAdminRequired |
43 | 43 | * @CORS |
44 | 44 | * @NoCSRFRequired |
45 | 45 | * |
46 | 46 | */ |
47 | - public function getAll() { |
|
48 | - $attachment = $this->attachmentService->findAll($this->request->getParam('cardId')); |
|
49 | - return new DataResponse($attachment, HTTP::STATUS_OK); |
|
50 | - } |
|
47 | + public function getAll() { |
|
48 | + $attachment = $this->attachmentService->findAll($this->request->getParam('cardId')); |
|
49 | + return new DataResponse($attachment, HTTP::STATUS_OK); |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
52 | + /** |
|
53 | 53 | * @NoAdminRequired |
54 | 54 | * @CORS |
55 | 55 | * @NoCSRFRequired |
56 | 56 | * |
57 | 57 | */ |
58 | - public function display() { |
|
59 | - $attachment = $this->attachmentService->display($this->request->getParam('cardId'), $this->request->getParam('attachmentId')); |
|
58 | + public function display() { |
|
59 | + $attachment = $this->attachmentService->display($this->request->getParam('cardId'), $this->request->getParam('attachmentId')); |
|
60 | 60 | return $attachment; |
61 | - } |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
63 | + /** |
|
64 | 64 | * @NoAdminRequired |
65 | 65 | * @CORS |
66 | 66 | * @NoCSRFRequired |
67 | 67 | * |
68 | 68 | */ |
69 | - public function create($type, $data) { |
|
70 | - $attachment = $this->attachmentService->create($this->request->getParam('cardId'), $type, $data); |
|
71 | - return new DataResponse($attachment, HTTP::STATUS_OK); |
|
72 | - } |
|
69 | + public function create($type, $data) { |
|
70 | + $attachment = $this->attachmentService->create($this->request->getParam('cardId'), $type, $data); |
|
71 | + return new DataResponse($attachment, HTTP::STATUS_OK); |
|
72 | + } |
|
73 | 73 | |
74 | - /** |
|
74 | + /** |
|
75 | 75 | * @NoAdminRequired |
76 | 76 | * @CORS |
77 | 77 | * @NoCSRFRequired |
78 | 78 | * |
79 | 79 | */ |
80 | - public function update($data) { |
|
81 | - $attachment = $this->attachmentService->update($this->request->getParam('cardId'), $this->request->getParam('attachmentId'), $data); |
|
82 | - return new DataResponse($attachment, HTTP::STATUS_OK); |
|
83 | - } |
|
80 | + public function update($data) { |
|
81 | + $attachment = $this->attachmentService->update($this->request->getParam('cardId'), $this->request->getParam('attachmentId'), $data); |
|
82 | + return new DataResponse($attachment, HTTP::STATUS_OK); |
|
83 | + } |
|
84 | 84 | |
85 | - /** |
|
85 | + /** |
|
86 | 86 | * @NoAdminRequired |
87 | 87 | * @CORS |
88 | 88 | * @NoCSRFRequired |
89 | 89 | * |
90 | 90 | */ |
91 | - public function delete() { |
|
92 | - $attachment = $this->attachmentService->delete($this->request->getParam('cardId'), $this->request->getParam('attachmentId')); |
|
93 | - return new DataResponse($attachment, HTTP::STATUS_OK); |
|
94 | - } |
|
91 | + public function delete() { |
|
92 | + $attachment = $this->attachmentService->delete($this->request->getParam('cardId'), $this->request->getParam('attachmentId')); |
|
93 | + return new DataResponse($attachment, HTTP::STATUS_OK); |
|
94 | + } |
|
95 | 95 | |
96 | - /** |
|
96 | + /** |
|
97 | 97 | * @NoAdminRequired |
98 | 98 | * @CORS |
99 | 99 | * @NoCSRFRequired |
100 | 100 | * |
101 | 101 | */ |
102 | - public function restore() { |
|
103 | - $attachment = $this->attachmentService->restore($this->request->getParam('cardId'), $this->request->getParam('attachmentId')); |
|
104 | - return new DataResponse($attachment, HTTP::STATUS_OK); |
|
105 | - } |
|
102 | + public function restore() { |
|
103 | + $attachment = $this->attachmentService->restore($this->request->getParam('cardId'), $this->request->getParam('attachmentId')); |
|
104 | + return new DataResponse($attachment, HTTP::STATUS_OK); |
|
105 | + } |
|
106 | 106 | } |
107 | 107 | \ No newline at end of file |
@@ -23,16 +23,13 @@ |
||
23 | 23 | |
24 | 24 | namespace OCA\Deck\Controller; |
25 | 25 | |
26 | -use OCA\Deck\Service\DefaultBoardService; |
|
27 | 26 | use OCP\AppFramework\Http\DataResponse; |
28 | 27 | use OCP\AppFramework\Http\NotFoundResponse; |
29 | 28 | use OCP\IConfig; |
30 | 29 | use OCP\IGroup; |
31 | 30 | use OCP\IGroupManager; |
32 | 31 | use OCP\IRequest; |
33 | -use OCP\AppFramework\Http\TemplateResponse; |
|
34 | 32 | use OCP\AppFramework\Controller; |
35 | -use OCP\IL10N; |
|
36 | 33 | |
37 | 34 | class ConfigController extends Controller { |
38 | 35 |
@@ -63,7 +63,7 @@ |
||
63 | 63 | public function index() { |
64 | 64 | $params = [ |
65 | 65 | 'user' => $this->userId, |
66 | - 'maxUploadSize' => (int)\OCP\Util::uploadLimit(), |
|
66 | + 'maxUploadSize' => (int) \OCP\Util::uploadLimit(), |
|
67 | 67 | 'canCreate' => $this->permissionService->canCreate() |
68 | 68 | ]; |
69 | 69 |