@@ -41,7 +41,6 @@ |
||
41 | 41 | use Cake\Http\ServerRequest; |
42 | 42 | use Cake\Log\Log; |
43 | 43 | use Cake\Mailer\Email; |
44 | -use Cake\Routing\DispatcherFactory; |
|
45 | 44 | use Cake\Utility\Inflector; |
46 | 45 | use Cake\Utility\Security; |
47 | 46 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | /* |
17 | 17 | * Configure paths required to find CakePHP + general filepath constants |
18 | 18 | */ |
19 | -require __DIR__ . '/paths.php'; |
|
19 | +require __DIR__.'/paths.php'; |
|
20 | 20 | |
21 | 21 | /* |
22 | 22 | * Bootstrap CakePHP. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * - Registering the CakePHP autoloader. |
28 | 28 | * - Setting the default application paths. |
29 | 29 | */ |
30 | -require CORE_PATH . 'config' . DS . 'bootstrap.php'; |
|
30 | +require CORE_PATH.'config'.DS.'bootstrap.php'; |
|
31 | 31 | |
32 | 32 | use Cake\Cache\Cache; |
33 | 33 | use Cake\Console\ConsoleErrorHandler; |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | * You should copy `config/.env.default to `config/.env` and set/modify the |
51 | 51 | * variables as required. |
52 | 52 | */ |
53 | -if (!env('APP_NAME') && file_exists(CONFIG . '.env')) { |
|
54 | - $dotenv = new \josegonzalez\Dotenv\Loader([CONFIG . '.env']); |
|
53 | +if (!env('APP_NAME') && file_exists(CONFIG.'.env')) { |
|
54 | + $dotenv = new \josegonzalez\Dotenv\Loader([CONFIG.'.env']); |
|
55 | 55 | $dotenv->parse() |
56 | 56 | ->putenv() |
57 | 57 | ->toEnv() |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * Load additional config files |
75 | 75 | */ |
76 | 76 | Configure::load('saito_config', 'default'); |
77 | - Configure::config('saitoCore', new PhpConfig(APP . '/Lib/')); |
|
77 | + Configure::config('saitoCore', new PhpConfig(APP.'/Lib/')); |
|
78 | 78 | Configure::load('version', 'saitoCore'); |
79 | 79 | |
80 | 80 | Configure::write( |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | Configure::load('email', 'default'); |
86 | 86 | } catch (\Exception $e) { |
87 | - exit($e->getMessage() . "\n"); |
|
87 | + exit($e->getMessage()."\n"); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /* |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * Include the CLI bootstrap overrides. |
137 | 137 | */ |
138 | 138 | if ($isCli) { |
139 | - require __DIR__ . '/bootstrap_cli.php'; |
|
139 | + require __DIR__.'/bootstrap_cli.php'; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /* |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | $httpHost = env('HTTP_HOST'); |
155 | 155 | if (isset($httpHost)) { |
156 | - Configure::write('App.fullBaseUrl', 'http' . $s . '://' . $httpHost); |
|
156 | + Configure::write('App.fullBaseUrl', 'http'.$s.'://'.$httpHost); |
|
157 | 157 | } |
158 | 158 | unset($httpHost, $s); |
159 | 159 | } |
@@ -175,12 +175,12 @@ discard block |
||
175 | 175 | /* |
176 | 176 | * Setup detectors for mobile and tablet. |
177 | 177 | */ |
178 | -ServerRequest::addDetector('mobile', function ($request) { |
|
178 | +ServerRequest::addDetector('mobile', function($request) { |
|
179 | 179 | $detector = new \Detection\MobileDetect(); |
180 | 180 | |
181 | 181 | return $detector->isMobile(); |
182 | 182 | }); |
183 | -ServerRequest::addDetector('tablet', function ($request) { |
|
183 | +ServerRequest::addDetector('tablet', function($request) { |
|
184 | 184 | $detector = new \Detection\MobileDetect(); |
185 | 185 | |
186 | 186 | return $detector->isTablet(); |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | |
232 | 232 | Plugin::load('ImageUploader', ['bootstrap' => true, 'routes' => true]); |
233 | 233 | |
234 | -include Cake\Core\App::path('Lib')[0] . 'BaseFunctions.php'; |
|
234 | +include Cake\Core\App::path('Lib')[0].'BaseFunctions.php'; |
|
235 | 235 | |
236 | 236 | \Cake\Event\EventManager::instance()->on(\Saito\Event\SaitoEventManager::getInstance()); |
237 | 237 |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | /** |
36 | 36 | * add new category |
37 | 37 | * |
38 | - * @return \Cake\Network\Response|void |
|
38 | + * @return \Cake\Http\Response|null |
|
39 | 39 | */ |
40 | 40 | public function add() |
41 | 41 | { |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * edit category |
67 | 67 | * |
68 | 68 | * @param string $id category-ID |
69 | - * @return \Cake\Network\Response|void |
|
69 | + * @return \Cake\Http\Response|null |
|
70 | 70 | */ |
71 | 71 | public function edit($id) |
72 | 72 | { |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @param string $id category-ID |
108 | 108 | * |
109 | - * @return \Cake\Network\Response|void |
|
109 | + * @return \Cake\Http\Response|null |
|
110 | 110 | */ |
111 | 111 | public function delete($id) |
112 | 112 | { |
@@ -123,7 +123,7 @@ |
||
123 | 123 | |
124 | 124 | switch ($this->request->getData('mode')) { |
125 | 125 | case ('move'): |
126 | - $targetId = (int)$this->request->getData('targetCategory'); |
|
126 | + $targetId = (int) $this->request->getData('targetCategory'); |
|
127 | 127 | try { |
128 | 128 | $this->Categories->merge($category->get('id'), $targetId); |
129 | 129 | $this->Flash->set( |
@@ -89,7 +89,7 @@ |
||
89 | 89 | * |
90 | 90 | * @param null $id settings-ID |
91 | 91 | * |
92 | - * @return \Cake\Network\Response|void |
|
92 | + * @return \Cake\Http\Response|null |
|
93 | 93 | */ |
94 | 94 | public function edit($id = null) |
95 | 95 | { |
@@ -1,6 +1,6 @@ |
||
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 |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | /** |
46 | 46 | * add user |
47 | 47 | * |
48 | - * @return \Cake\Network\Response|void |
|
48 | + * @return \Cake\Http\Response|null |
|
49 | 49 | */ |
50 | 50 | public function add() |
51 | 51 | { |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * delete user |
69 | 69 | * |
70 | 70 | * @param string $id user-ID |
71 | - * @return \Cake\Network\Response|void |
|
71 | + * @return \Cake\Http\Response|null |
|
72 | 72 | */ |
73 | 73 | public function delete($id) |
74 | 74 | { |
@@ -72,7 +72,7 @@ |
||
72 | 72 | */ |
73 | 73 | public function delete($id) |
74 | 74 | { |
75 | - $id = (int)$id; |
|
75 | + $id = (int) $id; |
|
76 | 76 | $exists = $this->Users->exists($id); |
77 | 77 | if (!$exists) { |
78 | 78 | $this->Flash->set(__('User not found.'), ['element' => 'error']); |
@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace Admin\Controller; |
4 | 4 | |
5 | -use App\Controller\AppController; |
|
6 | 5 | use App\Model\Table\UsersTable; |
7 | 6 | |
8 | 7 | /** |
@@ -15,7 +15,6 @@ |
||
15 | 15 | use App\Controller\AppController; |
16 | 16 | use Cake\Controller\Component\AuthComponent; |
17 | 17 | use Cake\Core\Configure; |
18 | -use Cake\Event\Event; |
|
19 | 18 | |
20 | 19 | /** |
21 | 20 | * Api App Controller |
@@ -1,6 +1,6 @@ |
||
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 |
@@ -566,6 +566,7 @@ |
||
566 | 566 | |
567 | 567 | /** |
568 | 568 | * {@inheritDoc} |
569 | + * @param string $content |
|
569 | 570 | */ |
570 | 571 | protected function _getUrl($content, $attributes) |
571 | 572 | { |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | return $this->Html->link($url, $url, ['target' => '_blank']); |
72 | 72 | } |
73 | 73 | |
74 | - $loader = function () use ($url) { |
|
74 | + $loader = function() use ($url) { |
|
75 | 75 | $embed = ['url' => $url]; |
76 | 76 | |
77 | 77 | try { |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | $callable = \Closure::fromCallable($loader); |
109 | 109 | |
110 | - $uid = 'embed-' . md5($url); |
|
110 | + $uid = 'embed-'.md5($url); |
|
111 | 111 | $info = Cache::remember($uid, $callable, 'bbcodeParserEmbed'); |
112 | 112 | |
113 | 113 | return $this->_sHelper->Html->div('js-embed', '', ['id' => $uid, 'data-embed' => json_encode($info)]); |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | } |
187 | 187 | |
188 | 188 | $ad = explode('|', $this->_sOptions->get('video_domains_allowed')); |
189 | - $trim = function ($v) { |
|
189 | + $trim = function($v) { |
|
190 | 190 | return trim($v); |
191 | 191 | }; |
192 | 192 | $this->_allowedVideoDomains = array_fill_keys(array_map($trim, $ad), 1); |
@@ -271,9 +271,9 @@ discard block |
||
271 | 271 | } |
272 | 272 | } |
273 | 273 | |
274 | - $out = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="' . $width . '" height="' . $height . '"> |
|
275 | - <param name="movie" value="' . $url . '"></param> |
|
276 | - <embed src="' . $url . '" width="' . $width . '" height="' . $height . '" type="application/x-shockwave-flash" wmode="opaque" style="width:' . $width . 'px; height:' . $height . 'px;" id="VideoPlayback" flashvars=""> </embed> </object>'; |
|
274 | + $out = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="'.$width.'" height="'.$height.'"> |
|
275 | + <param name="movie" value="' . $url.'"></param> |
|
276 | + <embed src="' . $url.'" width="'.$width.'" height="'.$height.'" type="application/x-shockwave-flash" wmode="opaque" style="width:'.$width.'px; height:'.$height.'px;" id="VideoPlayback" flashvars=""> </embed> </object>'; |
|
277 | 277 | |
278 | 278 | return $out; |
279 | 279 | } |
@@ -359,12 +359,12 @@ discard block |
||
359 | 359 | { |
360 | 360 | $listPieces = explode('[*]', $content); |
361 | 361 | unset($listPieces[0]); |
362 | - $listPieceProcessor = function ($li) { |
|
363 | - return '<li>' . $li . '</li>' . "\n"; |
|
362 | + $listPieceProcessor = function($li) { |
|
363 | + return '<li>'.$li.'</li>'."\n"; |
|
364 | 364 | }; |
365 | 365 | $listPieces = array_map($listPieceProcessor, $listPieces); |
366 | 366 | |
367 | - return '<ul>' . implode('', $listPieces) . '</ul>'; |
|
367 | + return '<ul>'.implode('', $listPieces).'</ul>'; |
|
368 | 368 | } |
369 | 369 | } |
370 | 370 | |
@@ -386,14 +386,14 @@ discard block |
||
386 | 386 | } |
387 | 387 | |
388 | 388 | $title = $this->_mbStrpad( |
389 | - ' ' . __('Spoiler') . ' ', |
|
389 | + ' '.__('Spoiler').' ', |
|
390 | 390 | $length, |
391 | 391 | '▇', |
392 | 392 | STR_PAD_BOTH |
393 | 393 | ); |
394 | 394 | |
395 | 395 | $json = json_encode(['string' => $content]); |
396 | - $id = 'spoiler_' . rand(0, 9999999999999); |
|
396 | + $id = 'spoiler_'.rand(0, 9999999999999); |
|
397 | 397 | |
398 | 398 | $out = <<<EOF |
399 | 399 | <div class="richtext-spoiler" style="display: inline;"> |
@@ -441,18 +441,18 @@ discard block |
||
441 | 441 | $result = null; |
442 | 442 | $repeat = ceil($strLen - $padStrLen + $padLen); |
443 | 443 | if ($dir == STR_PAD_RIGHT) { |
444 | - $result = $str . str_repeat($padStr, $repeat); |
|
444 | + $result = $str.str_repeat($padStr, $repeat); |
|
445 | 445 | $result = mb_substr($result, 0, $padLen); |
446 | 446 | } else { |
447 | 447 | if ($dir == STR_PAD_LEFT) { |
448 | - $result = str_repeat($padStr, $repeat) . $str; |
|
448 | + $result = str_repeat($padStr, $repeat).$str; |
|
449 | 449 | $result = mb_substr($result, -$padLen); |
450 | 450 | } else { |
451 | 451 | if ($dir == STR_PAD_BOTH) { |
452 | 452 | $length = ($padLen - $strLen) / 2; |
453 | 453 | $repeat = ceil($length / $padStrLen); |
454 | - $result = mb_substr(str_repeat($padStr, $repeat), 0, floor($length)) . |
|
455 | - $str . |
|
454 | + $result = mb_substr(str_repeat($padStr, $repeat), 0, floor($length)). |
|
455 | + $str. |
|
456 | 456 | mb_substr(str_repeat($padStr, $repeat), 0, ceil($length)); |
457 | 457 | } |
458 | 458 | } |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | 'fullBase' => true, |
488 | 488 | ]; |
489 | 489 | |
490 | - $url = '/useruploads/' . $content; |
|
490 | + $url = '/useruploads/'.$content; |
|
491 | 491 | $image = $this->_sHelper->Html->image($url, $params); |
492 | 492 | |
493 | 493 | if ($node->getParent()->getTagName() === 'Document') { |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | * Constructor |
209 | 209 | * |
210 | 210 | * @param Helper $Helper helper |
211 | - * @param array $settings settings |
|
211 | + * @param MarkupSettings $settings settings |
|
212 | 212 | */ |
213 | 213 | public function __construct(Helper $Helper, MarkupSettings $settings) |
214 | 214 | { |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * - `multimedia` bool true|false parse or ignore multimedia content |
226 | 226 | * - `embed` bool true|false parse or ignore embed content |
227 | 227 | * |
228 | - * @return mixed|string |
|
228 | + * @return string |
|
229 | 229 | */ |
230 | 230 | public function parse($string, array $options = []) |
231 | 231 | { |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | * Add definitin set |
316 | 316 | * |
317 | 317 | * @param string $set set |
318 | - * @param array $options options |
|
318 | + * @param MarkupSettings $options options |
|
319 | 319 | * |
320 | 320 | * @return void |
321 | 321 | * @throws \Exception |
@@ -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 |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | // serializing complex objects kills PHP |
282 | 282 | $serializable = array_filter( |
283 | 283 | $options, |
284 | - function ($value) { |
|
284 | + function($value) { |
|
285 | 285 | return !is_object($value); |
286 | 286 | } |
287 | 287 | ); |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | $this->_Parser->addCodeDefinition($builder->build()); |
336 | 336 | break; |
337 | 337 | case 'class': |
338 | - $class = '\Plugin\BbcodeParser\src\Lib\jBBCode\Definitions\\' . ucfirst($title); |
|
338 | + $class = '\Plugin\BbcodeParser\src\Lib\jBBCode\Definitions\\'.ucfirst($title); |
|
339 | 339 | $this->_Parser->addCodeDefinition(new $class($this->_Helper, $options)); |
340 | 340 | break; |
341 | 341 | default: |
@@ -355,10 +355,10 @@ discard block |
||
355 | 355 | return; |
356 | 356 | } |
357 | 357 | |
358 | - $folder = __DIR__ . '/jBBCode/Definitions/'; |
|
359 | - require_once $folder . 'JbbCodeDefinitions.php'; |
|
360 | - require_once $folder . 'JbbHtml5MediaCodeDefinition.php'; |
|
361 | - require_once $folder . 'JbbCodeCodeDefinition.php'; |
|
358 | + $folder = __DIR__.'/jBBCode/Definitions/'; |
|
359 | + require_once $folder.'JbbCodeDefinitions.php'; |
|
360 | + require_once $folder.'JbbHtml5MediaCodeDefinition.php'; |
|
361 | + require_once $folder.'JbbCodeCodeDefinition.php'; |
|
362 | 362 | |
363 | 363 | $this->areCombinedClassFilesLoaded = true; |
364 | 364 | } |
@@ -20,8 +20,6 @@ |
||
20 | 20 | use Cake\Http\Exception\NotFoundException; |
21 | 21 | use Cake\Network\Exception\MethodNotAllowedException; |
22 | 22 | use Cake\ORM\Entity; |
23 | -use Cake\ORM\Query; |
|
24 | -use Saito\App\Registry; |
|
25 | 23 | use Saito\Exception\SaitoForbiddenException; |
26 | 24 | |
27 | 25 | /** |
@@ -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 |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function edit($id) |
86 | 86 | { |
87 | - $id = (int)$id; |
|
87 | + $id = (int) $id; |
|
88 | 88 | $bookmark = $this->getBookmark($id); |
89 | 89 | |
90 | 90 | $this->Bookmarks->patchEntity( |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function delete($id) |
111 | 111 | { |
112 | - $id = (int)$id; |
|
112 | + $id = (int) $id; |
|
113 | 113 | $bookmark = $this->getBookmark($id); |
114 | 114 | if (!$this->Bookmarks->delete($bookmark)) { |
115 | 115 | throw new GenericApiException('The bookmark could not be deleted.'); |
@@ -12,7 +12,6 @@ |
||
12 | 12 | |
13 | 13 | namespace Bookmarks\Lib; |
14 | 14 | |
15 | -use App\Controller\Component\CurrentUserComponent; |
|
16 | 15 | use Cake\ORM\TableRegistry; |
17 | 16 | use Saito\User\CurrentUser\CurrentUserInterface; |
18 | 17 |
@@ -1,6 +1,6 @@ |
||
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 |