@@ -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; |
@@ -21,9 +20,7 @@ discard block |
||
21 | 20 | use Cake\Http\Exception\ForbiddenException; |
22 | 21 | use Cake\Http\Exception\MethodNotAllowedException; |
23 | 22 | use Cake\Http\Exception\NotFoundException; |
24 | -use Cake\I18n\Time; |
|
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; |
@@ -9,7 +9,6 @@ |
||
9 | 9 | use Cake\Event\Event; |
10 | 10 | use Cake\Http\Response; |
11 | 11 | use Cake\I18n\I18n; |
12 | -use Cake\Routing\Router; |
|
13 | 12 | use Saito\App\SettingsImmutable; |
14 | 13 | use Saito\Event\SaitoEventManager; |
15 | 14 | use Saito\User\CurrentUser\CurrentUser; |
@@ -9,7 +9,6 @@ |
||
9 | 9 | |
10 | 10 | namespace App\View\Helper; |
11 | 11 | |
12 | -use Cake\Core\Configure; |
|
13 | 12 | use Cake\View\Helper; |
14 | 13 | use Cake\View\StringTemplateTrait; |
15 | 14 |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | { |
65 | 65 | $html = "<i class=\"saito-icon fa fa-{$icon}\"></i>"; |
66 | 66 | if (!empty($text)) { |
67 | - $html .= ' <span class="saito-icon-text">' . $text . '</span>'; |
|
67 | + $html .= ' <span class="saito-icon-text">'.$text.'</span>'; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | return $html; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | public function dropdownMenuButton(array $menuItems, array $options = []) |
81 | 81 | { |
82 | 82 | $options += ['class' => 'btn btn-primary']; |
83 | - $options['class'] = $options['class'] . ' dropdown-toggle'; |
|
83 | + $options['class'] = $options['class'].' dropdown-toggle'; |
|
84 | 84 | $menu = []; |
85 | 85 | foreach ($menuItems as $menuItem) { |
86 | 86 | if ($menuItem === 'divider') { |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $contentArray += ['first' => '', 'middle' => '', 'last' => '']; |
174 | 174 | $out = ''; |
175 | 175 | foreach (['first', 'middle', 'last'] as $key) { |
176 | - $out .= '<div class="' . $key . '">'; |
|
176 | + $out .= '<div class="'.$key.'">'; |
|
177 | 177 | $out .= $options['escape'] ? h($contentArray[$key]) : $contentArray[$key]; |
178 | 178 | $out .= '</div>'; |
179 | 179 | } |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | } |
235 | 235 | $code = $this->request->getQuery('c'); |
236 | 236 | try { |
237 | - $activated = $this->Users->activate((int)$id, $code); |
|
237 | + $activated = $this->Users->activate((int) $id, $code); |
|
238 | 238 | } catch (\Exception $e) { |
239 | 239 | $activated = false; |
240 | 240 | } |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | public function ignore() |
293 | 293 | { |
294 | 294 | $this->request->allowMethod('POST'); |
295 | - $blockedId = (int)$this->request->getData('id'); |
|
295 | + $blockedId = (int) $this->request->getData('id'); |
|
296 | 296 | $this->_ignore($blockedId, true); |
297 | 297 | } |
298 | 298 | |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | public function unignore() |
305 | 305 | { |
306 | 306 | $this->request->allowMethod('POST'); |
307 | - $blockedId = (int)$this->request->getData('id'); |
|
307 | + $blockedId = (int) $this->request->getData('id'); |
|
308 | 308 | $this->_ignore($blockedId, false); |
309 | 309 | } |
310 | 310 | |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | protected function _ignore($blockedId, $set) |
319 | 319 | { |
320 | 320 | $userId = $this->CurrentUser->getId(); |
321 | - if ((int)$userId === (int)$blockedId) { |
|
321 | + if ((int) $userId === (int) $blockedId) { |
|
322 | 322 | throw new BadRequestException(); |
323 | 323 | } |
324 | 324 | if ($set) { |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | $user = $this->Users->find() |
380 | 380 | ->contain( |
381 | 381 | [ |
382 | - 'UserBlocks' => function ($q) { |
|
382 | + 'UserBlocks' => function($q) { |
|
383 | 383 | return $q->find('assocUsers'); |
384 | 384 | }, |
385 | 385 | 'UserOnline' |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | throw new BadRequestException; |
541 | 541 | } |
542 | 542 | |
543 | - $id = (int)$this->request->getData('lockUserId'); |
|
543 | + $id = (int) $this->request->getData('lockUserId'); |
|
544 | 544 | if (!$this->Users->exists($id)) { |
545 | 545 | throw new NotFoundException('User does not exist.', 1524298280); |
546 | 546 | } |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | $this->Flash->set($message, ['element' => 'error']); |
555 | 555 | } else { |
556 | 556 | try { |
557 | - $duration = (int)$this->request->getData('lockPeriod'); |
|
557 | + $duration = (int) $this->request->getData('lockPeriod'); |
|
558 | 558 | $blocker = new ManualBlocker($this->CurrentUser->getId(), $duration); |
559 | 559 | $status = $this->Users->UserBlocks->block($blocker, $id); |
560 | 560 | if (!$status) { |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | $allowed = $this->Slidetabs->getAvailable(); |
680 | 680 | $order = array_filter( |
681 | 681 | $order, |
682 | - function ($item) use ($allowed) { |
|
682 | + function($item) use ($allowed) { |
|
683 | 683 | return in_array($item, $allowed); |
684 | 684 | } |
685 | 685 | ); |
@@ -35,7 +35,7 @@ |
||
35 | 35 | return call_user_func_array([$this->_Posting, $method], $args); |
36 | 36 | } |
37 | 37 | throw new \RuntimeException( |
38 | - 'Undefined method ' . get_class($this) . '::' . $method |
|
38 | + 'Undefined method '.get_class($this).'::'.$method |
|
39 | 39 | ); |
40 | 40 | } |
41 | 41 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Saito - The Threaded Web Forum |
@@ -70,6 +70,6 @@ discard block |
||
70 | 70 | |
71 | 71 | $entity = $this->Table->newEntity($conditions); |
72 | 72 | |
73 | - return (bool)$this->Table->save($entity); |
|
73 | + return (bool) $this->Table->save($entity); |
|
74 | 74 | } |
75 | 75 | } |
@@ -12,7 +12,7 @@ |
||
12 | 12 | */ |
13 | 13 | public function __construct($type = null, $data = []) |
14 | 14 | { |
15 | - $message = 'Request was blackholed. Type: ' . $type; |
|
15 | + $message = 'Request was blackholed. Type: '.$type; |
|
16 | 16 | $logger = new ExceptionLogger; |
17 | 17 | $logger->write($message, $data); |
18 | 18 | parent::__construct($message, 400); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Saito - The Threaded Web Forum |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | { |
90 | 90 | $document = new \DOMDocument; |
91 | 91 | libxml_use_internal_errors(true); |
92 | - $document->loadHTML('<!DOCTYPE html>' . $html); |
|
92 | + $document->loadHTML('<!DOCTYPE html>'.$html); |
|
93 | 93 | $xpath = new \DOMXPath($document); |
94 | 94 | libxml_clear_errors(); |
95 | 95 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Saito - The Threaded Web Forum |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | $Mock = $this->getMockForTableParent($table, $methods); |
137 | 137 | EventManager::instance()->on( |
138 | 138 | 'Controller.initialize', |
139 | - function (Event $event) use ($table, $Mock) { |
|
139 | + function(Event $event) use ($table, $Mock) { |
|
140 | 140 | $Controller = $event->getSubject(); |
141 | 141 | $Controller->{$table} = $Mock; |
142 | 142 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $this->configRequest([ |
161 | 161 | 'headers' => [ |
162 | 162 | 'Accept' => 'application/json', |
163 | - 'Authorization' => 'bearer ' . $jwtToken, |
|
163 | + 'Authorization' => 'bearer '.$jwtToken, |
|
164 | 164 | ] |
165 | 165 | ]); |
166 | 166 | } |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | { |
315 | 315 | $this->assertContainsTag( |
316 | 316 | $expected, |
317 | - (string)$this->_controller->response->getBody() |
|
317 | + (string) $this->_controller->response->getBody() |
|
318 | 318 | ); |
319 | 319 | } |
320 | 320 | } |