@@ -188,7 +188,7 @@ |
||
188 | 188 | /** |
189 | 189 | * manually require auth and redirect cycle |
190 | 190 | * |
191 | - * @return Response |
|
191 | + * @return \Cake\Http\Response|null |
|
192 | 192 | */ |
193 | 193 | protected function _requireAuth() |
194 | 194 | { |
@@ -9,7 +9,6 @@ |
||
9 | 9 | use Cake\Event\Event; |
10 | 10 | use Cake\I18n\I18n; |
11 | 11 | use Cake\Network\Http\Response; |
12 | -use Cake\Routing\Router; |
|
13 | 12 | use Saito\App\SettingsImmutable; |
14 | 13 | use Saito\Event\SaitoEventManager; |
15 | 14 | use Saito\User\CurrentUser\CurrentUser; |
@@ -216,10 +216,10 @@ |
||
216 | 216 | return; |
217 | 217 | } |
218 | 218 | |
219 | - $check = function ($locale) { |
|
220 | - $l10nViewPath = $this->viewBuilder()->getTemplatePath() . DS . $locale; |
|
221 | - $l10nViewFile = $l10nViewPath . DS . $this->viewBuilder()->getName() . '.ctp'; |
|
222 | - if (!file_exists(APP . 'Template' . DS . $l10nViewFile)) { |
|
219 | + $check = function($locale) { |
|
220 | + $l10nViewPath = $this->viewBuilder()->getTemplatePath().DS.$locale; |
|
221 | + $l10nViewFile = $l10nViewPath.DS.$this->viewBuilder()->getName().'.ctp'; |
|
222 | + if (!file_exists(APP.'Template'.DS.$l10nViewFile)) { |
|
223 | 223 | return false; |
224 | 224 | } |
225 | 225 |
@@ -16,7 +16,6 @@ discard block |
||
16 | 16 | use Cake\Core\Configure; |
17 | 17 | use Cake\Event\Event; |
18 | 18 | use Cake\ORM\TableRegistry; |
19 | -use Cake\Routing\Router; |
|
20 | 19 | use Cake\Utility\Security; |
21 | 20 | use Firebase\JWT\JWT; |
22 | 21 | use Saito\App\Registry; |
@@ -26,7 +25,6 @@ discard block |
||
26 | 25 | use Saito\User\CurrentUser\CurrentUserInterface; |
27 | 26 | use Saito\User\CurrentUser\CurrentUserTrait; |
28 | 27 | use Saito\User\LastRefresh; |
29 | -use Saito\User\ReadPostings; |
|
30 | 28 | use Saito\User\ReadPostings\ReadPostingsCookie; |
31 | 29 | use Saito\User\ReadPostings\ReadPostingsDatabase; |
32 | 30 | use Saito\User\ReadPostings\ReadPostingsDummy; |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | } |
181 | 181 | |
182 | 182 | //= set persistent Cookie |
183 | - $setCookie = (bool)$this->request->getData('remember_me'); |
|
183 | + $setCookie = (bool) $this->request->getData('remember_me'); |
|
184 | 184 | if ($setCookie) { |
185 | 185 | (new CurrentUserCookie($this->getController()))->write($this->getId()); |
186 | 186 | }; |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | $auth->setConfig('loginAction', '/login'); |
293 | 293 | |
294 | 294 | $here = urlencode($this->getController()->getRequest()->getRequestTarget()); |
295 | - $auth->setConfig('unauthorizedRedirect', '/login?redirect=' . $here); |
|
295 | + $auth->setConfig('unauthorizedRedirect', '/login?redirect='.$here); |
|
296 | 296 | |
297 | 297 | if ($this->isLoggedIn()) { |
298 | 298 | $auth->allow(); |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | */ |
319 | 319 | private function setJwtCookie(Controller $controller): void |
320 | 320 | { |
321 | - $cookieKey = Configure::read('Session.cookie') . '-jwt'; |
|
321 | + $cookieKey = Configure::read('Session.cookie').'-jwt'; |
|
322 | 322 | $cookie = (new Storage($controller, $cookieKey, ['http' => false, 'expire' => '+1 week'])); |
323 | 323 | |
324 | 324 | $existingToken = $cookie->read(); |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace App\Controller\Component; |
4 | 4 | |
5 | 5 | use Cake\Controller\Component; |
6 | -use Cake\Core\Configure; |
|
7 | 6 | use Saito\User\ForumsUserInterface; |
8 | 7 | |
9 | 8 | class SlidetabsComponent extends Component |
@@ -49,7 +49,7 @@ |
||
49 | 49 | $tabs = $slidetabs; |
50 | 50 | } |
51 | 51 | $tabs = array_map( |
52 | - function ($v) { |
|
52 | + function($v) { |
|
53 | 53 | return $this->_available[$v]; |
54 | 54 | }, |
55 | 55 | $tabs |
@@ -15,7 +15,6 @@ |
||
15 | 15 | use Cake\Core\Configure; |
16 | 16 | use Cake\ORM\Entity; |
17 | 17 | use Cake\ORM\TableRegistry; |
18 | -use Cake\Utility\Hash; |
|
19 | 18 | use Saito\App\Registry; |
20 | 19 | use Saito\Posting\Posting; |
21 | 20 | use Stopwatch\Lib\Stopwatch; |
@@ -80,14 +80,14 @@ |
||
80 | 80 | 'order' => $order, |
81 | 81 | // Performance: Custom counter from categories counter-cache; |
82 | 82 | // avoids a costly COUNT(*) DB call counting all pages for pagination. |
83 | - 'counter' => function ($query) use ($categories) { |
|
83 | + 'counter' => function($query) use ($categories) { |
|
84 | 84 | $results = $this->Entries->Categories->find('all') |
85 | 85 | ->select(['thread_count']) |
86 | 86 | ->where(['id IN' => $categories]) |
87 | 87 | ->all(); |
88 | 88 | $count = array_reduce( |
89 | 89 | $results->toArray(), |
90 | - function ($carry, Entity $entity) { |
|
90 | + function($carry, Entity $entity) { |
|
91 | 91 | return $carry + $entity->get('thread_count'); |
92 | 92 | }, |
93 | 93 | 0 |
@@ -85,7 +85,7 @@ |
||
85 | 85 | * @param Form $contact contact-form |
86 | 86 | * @param mixed $recipient recipient |
87 | 87 | * @param mixed $sender sender |
88 | - * @return \Cake\Network\Response|void |
|
88 | + * @return \Cake\Http\Response|null |
|
89 | 89 | */ |
90 | 90 | protected function _contact(Form $contact, $recipient, $sender) |
91 | 91 | { |
@@ -105,7 +105,7 @@ |
||
105 | 105 | 'subject' => $this->request->getData('subject'), |
106 | 106 | 'message' => $this->request->getData('text'), |
107 | 107 | 'template' => 'user_contact', |
108 | - 'ccsender' => (bool)$this->request->getData('cc'), |
|
108 | + 'ccsender' => (bool) $this->request->getData('cc'), |
|
109 | 109 | ]; |
110 | 110 | $this->SaitoEmail->email($email); |
111 | 111 | $message = __('Message was send.'); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | /** |
65 | 65 | * posting index |
66 | 66 | * |
67 | - * @return void|\Cake\Network\Response |
|
67 | + * @return \Cake\Http\Response|null |
|
68 | 68 | */ |
69 | 69 | public function index() |
70 | 70 | { |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * Mix view |
112 | 112 | * |
113 | 113 | * @param string $tid thread-ID |
114 | - * @return void|Response |
|
114 | + * @return \Cake\Http\Response|null |
|
115 | 115 | * @throws NotFoundException |
116 | 116 | */ |
117 | 117 | public function mix($tid) |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | * View posting. |
185 | 185 | * |
186 | 186 | * @param string $id posting-ID |
187 | - * @return \Cake\Network\Response|void |
|
187 | + * @return \Cake\Http\Response|null |
|
188 | 188 | */ |
189 | 189 | public function view($id = null) |
190 | 190 | { |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | * Add new posting. |
237 | 237 | * |
238 | 238 | * @param null|string $id parent-ID if is answer |
239 | - * @return void|\Cake\Network\Response |
|
239 | + * @return \Cake\Http\Response|null |
|
240 | 240 | * @throws ForbiddenException |
241 | 241 | */ |
242 | 242 | public function add($id = null) |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | * Get thread-line to insert after an inline-answer |
346 | 346 | * |
347 | 347 | * @param string $id posting-ID |
348 | - * @return void|\Cake\Network\Response |
|
348 | + * @return \Cake\Http\Response|null |
|
349 | 349 | */ |
350 | 350 | public function threadLine($id = null) |
351 | 351 | { |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | * Edit posting |
365 | 365 | * |
366 | 366 | * @param string $id posting-ID |
367 | - * @return void|\Cake\Network\Response |
|
367 | + * @return \Cake\Http\Response|null |
|
368 | 368 | * @throws NotFoundException |
369 | 369 | * @throws BadRequestException |
370 | 370 | */ |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | * @param string $id posting-ID |
571 | 571 | * @param string $toggle property |
572 | 572 | * |
573 | - * @return \Cake\Network\Response |
|
573 | + * @return \Cake\Http\Response |
|
574 | 574 | */ |
575 | 575 | public function ajaxToggle($id = null, $toggle = null) |
576 | 576 | { |
@@ -9,7 +9,6 @@ discard block |
||
9 | 9 | |
10 | 10 | namespace App\Controller; |
11 | 11 | |
12 | -use App\Controller\Component\CurrentUserComponent; |
|
13 | 12 | use App\Controller\Component\MarkAsReadComponent; |
14 | 13 | use App\Controller\Component\ThreadsComponent; |
15 | 14 | use App\Model\Entity\Entry; |
@@ -19,11 +18,9 @@ discard block |
||
19 | 18 | use Cake\Http\Exception\BadRequestException; |
20 | 19 | use Cake\Http\Exception\ForbiddenException; |
21 | 20 | use Cake\Http\Exception\NotFoundException; |
22 | -use Cake\I18n\Time; |
|
23 | 21 | use Cake\Network\Exception\MethodNotAllowedException; |
24 | 22 | use Cake\Network\Http\Response; |
25 | 23 | use Cake\Routing\RequestActionTrait; |
26 | -use Saito\App\Registry; |
|
27 | 24 | use Saito\Posting\Posting; |
28 | 25 | use Saito\User\ForumsUserInterface; |
29 | 26 | use Stopwatch\Lib\Stopwatch; |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | $threads = $this->Threads->paginate($order); |
82 | 82 | $this->set('entries', $threads); |
83 | 83 | |
84 | - $currentPage = (int)$this->request->getQuery('page') ?: 1; |
|
84 | + $currentPage = (int) $this->request->getQuery('page') ?: 1; |
|
85 | 85 | if ($currentPage > 1) { |
86 | - $this->set('titleForLayout', __('page') . ' ' . $currentPage); |
|
86 | + $this->set('titleForLayout', __('page').' '.$currentPage); |
|
87 | 87 | } |
88 | 88 | if ($currentPage === 1) { |
89 | 89 | if ($this->MarkAsRead->refresh()) { |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function mix($tid) |
118 | 118 | { |
119 | - $tid = (int)$tid; |
|
119 | + $tid = (int) $tid; |
|
120 | 120 | if ($tid <= 0) { |
121 | 121 | throw new BadRequestException(); |
122 | 122 | } |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | $redirect = '/'; |
486 | 486 | } else { |
487 | 487 | $message = __('delete_subtree_success'); |
488 | - $redirect = '/entries/view/' . $posting->get('pid'); |
|
488 | + $redirect = '/entries/view/'.$posting->get('pid'); |
|
489 | 489 | } |
490 | 490 | } else { |
491 | 491 | $flashType = 'error'; |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | $targetId = $this->request->getData('targetId'); |
553 | 553 | if (!empty($targetId)) { |
554 | 554 | if ($this->Entries->threadMerge($sourceId, $targetId)) { |
555 | - $this->redirect('/entries/view/' . $sourceId); |
|
555 | + $this->redirect('/entries/view/'.$sourceId); |
|
556 | 556 | |
557 | 557 | return; |
558 | 558 | } else { |
@@ -583,11 +583,11 @@ discard block |
||
583 | 583 | throw new BadRequestException; |
584 | 584 | } |
585 | 585 | |
586 | - $current = $this->Entries->toggle((int)$id, $toggle); |
|
586 | + $current = $this->Entries->toggle((int) $id, $toggle); |
|
587 | 587 | if ($current) { |
588 | - $out['html'] = __d('nondynamic', $toggle . '_unset_entry_link'); |
|
588 | + $out['html'] = __d('nondynamic', $toggle.'_unset_entry_link'); |
|
589 | 589 | } else { |
590 | - $out['html'] = __d('nondynamic', $toggle . '_set_entry_link'); |
|
590 | + $out['html'] = __d('nondynamic', $toggle.'_set_entry_link'); |
|
591 | 591 | } |
592 | 592 | |
593 | 593 | $this->response = $this->response->withType('json'); |
@@ -26,7 +26,7 @@ |
||
26 | 26 | /** |
27 | 27 | * Generate posting preview for JSON frontend. |
28 | 28 | * |
29 | - * @return \Cake\Network\Response|void |
|
29 | + * @return null|\Cake\Http\Response |
|
30 | 30 | * @throws BadRequestException |
31 | 31 | * @throws ForbiddenException |
32 | 32 | */ |
@@ -68,9 +68,9 @@ |
||
68 | 68 | $jsonApiErrors = ['errors' => []]; |
69 | 69 | foreach ($errors as $field => $error) { |
70 | 70 | $out = [ |
71 | - 'meta' => ['field' => '#' . $this->_domId($field)], |
|
71 | + 'meta' => ['field' => '#'.$this->_domId($field)], |
|
72 | 72 | 'status' => '400', |
73 | - 'title' => __d('nondynamic', $field) . ": " . __d('nondynamic', current($error)), |
|
73 | + 'title' => __d('nondynamic', $field).": ".__d('nondynamic', current($error)), |
|
74 | 74 | ]; |
75 | 75 | |
76 | 76 | $jsonApiErrors['errors'][] = $out; |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * Current app status ping |
16 | 16 | * |
17 | - * @return string |
|
17 | + * @return \Cake\Http\Response |
|
18 | 18 | * @throws BadRequestException |
19 | 19 | */ |
20 | 20 | public function status() |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * Get status as JSON response |
56 | 56 | * |
57 | 57 | * @param string $data json-encoded data |
58 | - * @return mixed |
|
58 | + * @return string |
|
59 | 59 | */ |
60 | 60 | protected function _statusAsJson($data) |
61 | 61 | { |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Cake\Event\Event; |
6 | 6 | use Cake\Http\Exception\BadRequestException; |
7 | -use Cake\ORM\TableRegistry; |
|
8 | 7 | |
9 | 8 | class StatusController extends AppController |
10 | 9 | { |
@@ -46,7 +46,7 @@ |
||
46 | 46 | $this->response->disableCache(); |
47 | 47 | $out = ''; |
48 | 48 | $out .= "retry: $retry\n"; |
49 | - $out .= 'data: ' . $data . "\n\n"; |
|
49 | + $out .= 'data: '.$data."\n\n"; |
|
50 | 50 | |
51 | 51 | return $out; |
52 | 52 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | /** |
57 | 57 | * Login user. |
58 | 58 | * |
59 | - * @return void|\Cake\Network\Response |
|
59 | + * @return null|Response |
|
60 | 60 | */ |
61 | 61 | public function login() |
62 | 62 | { |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | * |
310 | 310 | * @param int $blockedId user to ignore |
311 | 311 | * @param bool $set block or unblock |
312 | - * @return \Cake\Network\Response |
|
312 | + * @return Response|null |
|
313 | 313 | */ |
314 | 314 | protected function _ignore($blockedId, $set) |
315 | 315 | { |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | * View user profile. |
360 | 360 | * |
361 | 361 | * @param null $id user-ID |
362 | - * @return \Cake\Network\Response|void |
|
362 | + * @return null|Response |
|
363 | 363 | */ |
364 | 364 | public function view($id = null) |
365 | 365 | { |
@@ -420,8 +420,8 @@ discard block |
||
420 | 420 | /** |
421 | 421 | * Set user avatar. |
422 | 422 | * |
423 | - * @param string $userId user-ID |
|
424 | - * @return void|\Cake\Network\Response |
|
423 | + * @param integer $userId user-ID |
|
424 | + * @return Response|null |
|
425 | 425 | */ |
426 | 426 | public function avatar(int $userId) |
427 | 427 | { |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | * |
455 | 455 | * @param null $id user-ID |
456 | 456 | * |
457 | - * @return \Cake\Network\Response|void |
|
457 | + * @return Response|null |
|
458 | 458 | */ |
459 | 459 | public function edit($id = null) |
460 | 460 | { |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | /** |
662 | 662 | * Set slidetab-order. |
663 | 663 | * |
664 | - * @return \Cake\Network\Response |
|
664 | + * @return Response |
|
665 | 665 | * @throws BadRequestException |
666 | 666 | */ |
667 | 667 | public function slidetabOrder() |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | * Set category for user. |
710 | 710 | * |
711 | 711 | * @param null $id category-ID |
712 | - * @return \Cake\Network\Response |
|
712 | + * @return Response|null |
|
713 | 713 | * @throws ForbiddenException |
714 | 714 | */ |
715 | 715 | public function setcategory($id = null) |
@@ -10,7 +10,6 @@ |
||
10 | 10 | namespace App\Controller; |
11 | 11 | |
12 | 12 | use App\Controller\Component\RefererComponent; |
13 | -use App\Controller\Component\ThemesComponent; |
|
14 | 13 | use App\Form\BlockForm; |
15 | 14 | use App\Model\Entity\User; |
16 | 15 | use App\Model\Table\UsersTable; |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | } |
231 | 231 | $code = $this->request->getQuery('c'); |
232 | 232 | try { |
233 | - $activated = $this->Users->activate((int)$id, $code); |
|
233 | + $activated = $this->Users->activate((int) $id, $code); |
|
234 | 234 | } catch (\Exception $e) { |
235 | 235 | $activated = false; |
236 | 236 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | public function ignore() |
289 | 289 | { |
290 | 290 | $this->request->allowMethod('POST'); |
291 | - $blockedId = (int)$this->request->getData('id'); |
|
291 | + $blockedId = (int) $this->request->getData('id'); |
|
292 | 292 | $this->_ignore($blockedId, true); |
293 | 293 | } |
294 | 294 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | public function unignore() |
301 | 301 | { |
302 | 302 | $this->request->allowMethod('POST'); |
303 | - $blockedId = (int)$this->request->getData('id'); |
|
303 | + $blockedId = (int) $this->request->getData('id'); |
|
304 | 304 | $this->_ignore($blockedId, false); |
305 | 305 | } |
306 | 306 | |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | protected function _ignore($blockedId, $set) |
315 | 315 | { |
316 | 316 | $userId = $this->CurrentUser->getId(); |
317 | - if ((int)$userId === (int)$blockedId) { |
|
317 | + if ((int) $userId === (int) $blockedId) { |
|
318 | 318 | throw new BadRequestException(); |
319 | 319 | } |
320 | 320 | if ($set) { |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | $user = $this->Users->find() |
376 | 376 | ->contain( |
377 | 377 | [ |
378 | - 'UserBlocks' => function ($q) { |
|
378 | + 'UserBlocks' => function($q) { |
|
379 | 379 | return $q->find('assocUsers'); |
380 | 380 | }, |
381 | 381 | 'UserOnline' |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | throw new BadRequestException; |
537 | 537 | } |
538 | 538 | |
539 | - $id = (int)$this->request->getData('lockUserId'); |
|
539 | + $id = (int) $this->request->getData('lockUserId'); |
|
540 | 540 | if (!$this->Users->exists($id)) { |
541 | 541 | throw new NotFoundException('User does not exist.', 1524298280); |
542 | 542 | } |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | $this->Flash->set($message, ['element' => 'error']); |
551 | 551 | } else { |
552 | 552 | try { |
553 | - $duration = (int)$this->request->getData('lockPeriod'); |
|
553 | + $duration = (int) $this->request->getData('lockPeriod'); |
|
554 | 554 | $status = $this->Users->UserBlocks->block( |
555 | 555 | new ManualBlocker, |
556 | 556 | $id, |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | $allowed = $this->Slidetabs->getAvailable(); |
679 | 679 | $order = array_filter( |
680 | 680 | $order, |
681 | - function ($item) use ($allowed) { |
|
681 | + function($item) use ($allowed) { |
|
682 | 682 | return in_array($item, $allowed); |
683 | 683 | } |
684 | 684 | ); |